60 lines
1.5 KiB
Python
60 lines
1.5 KiB
Python
import uuid
|
|
from datetime import date
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class CompanyCreate(BaseModel):
|
|
name: str = Field(min_length=2, max_length=200)
|
|
address: str | None = Field(default=None, max_length=500)
|
|
|
|
|
|
class CompanyRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: uuid.UUID
|
|
name: str
|
|
address: str | None
|
|
is_active: bool
|
|
|
|
|
|
class HeadquartersCreate(BaseModel):
|
|
code: str = Field(min_length=1, max_length=20)
|
|
name: str = Field(min_length=2, max_length=200)
|
|
district: str | None = Field(default=None, max_length=100)
|
|
state: str | None = Field(default=None, max_length=100)
|
|
|
|
|
|
class HeadquartersRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: uuid.UUID
|
|
company_id: uuid.UUID
|
|
code: str
|
|
name: str
|
|
district: str | None
|
|
state: str | None
|
|
is_active: bool
|
|
|
|
|
|
class AssignAreaManager(BaseModel):
|
|
area_manager_user_id: uuid.UUID
|
|
effective_from: date | None = None
|
|
|
|
|
|
class SetAreaManagerHeadquarters(BaseModel):
|
|
"""The complete list of headquarters an Area Manager should manage (may be empty)."""
|
|
|
|
headquarters_ids: list[uuid.UUID] = Field(default_factory=list, max_length=500)
|
|
effective_from: date | None = None
|
|
|
|
|
|
class AMHeadquartersRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: uuid.UUID
|
|
area_manager_user_id: uuid.UUID
|
|
headquarters_id: uuid.UUID
|
|
effective_from: date
|
|
effective_to: date | None
|