"""Pydantic Model For Ledger Adjustment.""" from pydantic import BaseModel from pydantic import ConfigDict from moneyhub.constants.constants import DistributionType from moneyhub.schemas.pagination import PaginationSchema class LedgerAdjustmentSchema(BaseModel): """Ledger adjustment model.""" worksheet_adjustment_id: int account_id: int activity_statement_period_id: int adjustment_amount_payee_currency: float adjustment_payee_currency_code: str apply_to_statement_period_id: int contract_id: int | None = None reference_adjustment_type_id: int reference_adjustment_type_name: str note: str | None = None model_config = ConfigDict(from_attributes=True) class BreakdownItemSchema(BaseModel): """Breakdown item base model.""" adjustment_total_payee_currency: float adjustment_payee_currency_code: str reference_adjustment_type_id: int reference_adjustment_type_name: str model_config = ConfigDict(from_attributes=True) class LedgerAdjustmentBreakdownItemSchema(BreakdownItemSchema): """Ledger adjustment model.""" contract_id: int | None = None model_config = ConfigDict(from_attributes=True) class LedgerAdjustmentAppliedSchema(BaseModel): """Aggregate value of applied adjustments to a statement period.""" adjustment_total_payee_currency: float adjustment_payee_currency_code: str breakdown_items: list[LedgerAdjustmentBreakdownItemSchema] statement_period_id: int model_config = ConfigDict(from_attributes=True) class ExpenseSchema(BaseModel): """Expense model.""" account_id: int | None = None worksheet_adjustment_detail_id: int | None = None apply_to_statement_period_id: int | None = None adjustment_amount_payee_currency: float adjustment_payee_currency_code: str artist_id: int | None = None artist_name: str | None = None contract_id: int | None = None distribution_type: str | None = None imprint: str | None = None imprint_id: int | None = None note: str | None = None reference_adjustment_type_id: int | None = None reference_adjustment_type_name: str | None = None subaccount_id: int | None = None subaccount_name: str | None = None upc: str | None = None model_config = ConfigDict(from_attributes=True) class PaginatedExpenseSchema(BaseModel): """Expense aggregated with pagination.""" items: list[ExpenseSchema] pagination: PaginationSchema class LedgerAdjustmentExpenseSchema(BaseModel): """Aggregate value of expenses for a period.""" amount: float currency_code: str breakdown_items: list[BreakdownItemSchema] statement_period_id: int model_config = ConfigDict(from_attributes=True) class LedgerAdjustmentExpenseArtistSchema(BaseModel): """Artist ID and name for an artist associated with an expense.""" artist_id: int | None artist_name: str | None model_config = ConfigDict(from_attributes=True) class ExpenseSubaccountSchema(BaseModel): """Subaccount ID and name for a subaccount associated with an expense.""" account_id: int subaccount_id: int | None subaccount_name: str | None model_config = ConfigDict(from_attributes=True) class LedgerAdjustmentExpenseUPCsSchema(BaseModel): """UPC and distribution type used to identify a product associated with an expense.""" account_id: int upc: str distribution_type: DistributionType model_config = ConfigDict(from_attributes=True)