"""Immutable Pydantic models for file metadata and column mapping. Defines frozen value objects used throughout the adjustment file preparation pipeline. Immutability provides thread safety and prevents accidental mutations during processing. Models: - ColumnMapping: Maps external file columns to internal database columns - FileMetadata: File path, encoding, type, and compression status """ from pathlib import Path from pydantic import BaseModel, ConfigDict, Field from src.enums import FileType class ColumnMapping(BaseModel): """Maps external file column names to internal database columns with required flag.""" model_config = ConfigDict(frozen=True) column_name: str = Field( ..., description='Internal column name in the database table' ) display_name: str = Field( ..., description='Column name as it appears in the external file' ) required: bool = Field( default=False, description='Whether the column must be present in the file' ) class FileMetadata(BaseModel): """File metadata including path, encoding, detected type, and compression status.""" model_config = ConfigDict(frozen=True) encoding: str = Field(..., description='Character encoding (e.g., utf-8, latin-1)') file_path: Path = Field(..., description='Absolute path to the file') file_type: FileType = Field(..., description='Detected file type') gzipped: bool = Field(..., description='Whether the file is gzip compressed')