"""Work Groups domain Pydantic schemas."""
from __future__ import annotations
import datetime
from typing import Annotated
from uuid import UUID
from pydantic import BaseModel, ConfigDict, Field
[docs]
class WorkGroupBase(BaseModel):
"""Base WorkGroup schema with common fields."""
name: Annotated[str, Field(min_length=1, max_length=255)]
purpose: str
active: bool = True
url: str | None = None
[docs]
class WorkGroupCreate(WorkGroupBase):
"""Schema for creating a new WorkGroup."""
creator_id: UUID
[docs]
class WorkGroupUpdate(BaseModel):
"""Schema for updating a WorkGroup."""
name: Annotated[str, Field(min_length=1, max_length=255)] | None = None
purpose: str | None = None
active: bool | None = None
url: str | None = None
[docs]
class WorkGroupRead(WorkGroupBase):
"""Schema for reading WorkGroup data."""
id: UUID
slug: str
creator_id: UUID
created_at: datetime.datetime
updated_at: datetime.datetime
model_config = ConfigDict(from_attributes=True)
[docs]
class WorkGroupList(BaseModel):
"""Schema for WorkGroup list items."""
id: UUID
slug: str
name: str
active: bool
created_at: datetime.datetime
model_config = ConfigDict(from_attributes=True)