PayrollManagementSystem/backend/app/schemas/coefficient.py

24 lines
828 B
Python
Raw Normal View History

"""系数表与 Excel 导入共用的边界模型。"""
from datetime import date
from typing import Literal
from pydantic import BaseModel, Field
class CoefficientRowIn(BaseModel):
product_category: Literal["municipal_water", "rail_transit"]
customer_type: Literal["personal", "enterprise"]
stage: Literal["first", "linear", "after", "fixed"]
value: str = Field(min_length=1, max_length=64)
slope: str | None = Field(default=None, max_length=64)
boundary: int | None = Field(default=None, ge=1, le=3660)
class CoefficientChangeIn(BaseModel):
effective_date: date
base_date: date | None = None
remark: str = Field(default="系数表维护", max_length=255)
fingerprint: str = Field(min_length=64, max_length=64)
rows: list[CoefficientRowIn] = Field(min_length=1, max_length=16)