"""Pydantic models for database records.""" from typing import Optional from pydantic import BaseModel, Field, field_validator class AdjustmentBatch(BaseModel): """Model for worksheet_flowthrough_batch table record.""" batch_id: int batch_type: str batch_status: str source_file_upload_id: Optional[int] statement_period_id: int class FileUpload(BaseModel): """Model for file_upload table record.""" file_upload_id: int s3_bucket: str = Field(..., min_length=3, max_length=63) s3_key: str = Field(..., min_length=1, max_length=1024) original_file_name: str upload_status: str upload_type: str created_by: str @field_validator('s3_bucket') @classmethod def validate_bucket_name(cls, value: str) -> str: """Validate a bucket name.""" if not value or '/' in value: raise ValueError('Invalid S3 bucket name') return value class StatementPeriod(BaseModel): """Model for statement_period table record.""" statement_period_id: int statement_period_name: str statement_period_status: str statement_month: Optional[int] statement_year: Optional[int]