"""Schema for Worksheet Account Contract Closing Balance.""" from abacus_common_logic.marshalling.base import PaginationSchema from abacus_common_logic.marshalling.custom_fields import ma from abacus_common_logic.marshalling.helpers import MarshmallowSchemaFactory from marshmallow import validate from webargs import fields class WorksheetAccountContractClosingBalanceInputSchema(ma.Schema): """ Schema for Worksheet Account Contract Closing Balance. This schema defines the structure and validation rules for the Worksheet Account Contract Closing Balance. It specifies the required fields and their data types. Attributes: account_id (int): The ID of the account. contract_id (int): The ID of the contract. ledger_account_contract_id (int): The ID of the ledger account contract. currency_code (str): The currency code. amount (decimal): The amount. includes_tax_adjustments (bool): Indicates whether the balance includes tax adjustments. """ # noqa: E501 account_id = ma.NonNegativeInteger(required=True) contract_id = ma.NonNegativeInteger(required=True) ledger_account_contract_id = ma.NonNegativeInteger(required=True) currency_code = ma.NonemptyString(required=True) amount = ma.Decimal(as_string=True, required=True) includes_tax_adjustments = ma.Boolean(required=True) class WorksheetAccountContractClosingBalanceSchema(ma.Schema): """ Schema for Worksheet Account Contract Closing Balance. This schema defines the structure and validation rules for the Worksheet Account Contract Closing Balance. It specifies the required fields and their data types. Attributes: worksheet_account_contract_closing_balance_id (int): The ID of the worksheet account contract closing balance. account_id (int): The ID of the account. contract_id (int): The ID of the contract. reference_payment_entity_id (int): The ID of the reference payment entity. abacus_event_id (int): The ID of the Abacus event. ledger_account_contract_id (int): The ID of the ledger account contract. statement_period_id (int): The ID of the statement period. currency_code (str): The currency code. amount (decimal): The amount. includes_tax_adjustments (bool): Indicates whether the balance includes tax adjustments. """ # noqa: E501 worksheet_account_contract_closing_balance_id = ma.NonNegativeInteger(required=True) account_id = ma.NonNegativeInteger(required=True) contract_id = ma.NonNegativeInteger(required=True) ledger_account_contract_id = ma.NonNegativeInteger(required=True) currency_code = ma.NonemptyString(required=True) amount = ma.Decimal(as_string=True, required=True) includes_tax_adjustments = ma.Boolean(required=True) reference_payment_entity_id = ma.NonNegativeInteger(required=True) abacus_event_id = ma.NonNegativeInteger(required=True) statement_period_id = ma.NonNegativeInteger(required=True) class PaginatedWorksheetAccountContractClosingBalanceOutputSchema(ma.Schema): """ Schema for Paginated Worksheet Account Contract Closing Balance. This schema defines the structure and validation rules for the Paginated Worksheet Account Contract Closing Balance. It specifies the required fields and their data types. Attributes: items (List[WorksheetAccountContractClosingBalanceSchema]): The list of Worksheet Account Contract Closing Balance. total_count (int): The total count of Worksheet Account Contract Closing Balance. """ # noqa: E501 items = ma.Nested( WorksheetAccountContractClosingBalanceSchema, many=True, example=MarshmallowSchemaFactory( WorksheetAccountContractClosingBalanceSchema, many=True ).dump( [ { 'worksheet_account_contract_closing_balance_id': 1, 'account_id': 1, 'contract_id': 1, 'reference_payment_entity_id': 1, 'abacus_event_id': 1, 'ledger_account_contract_id': 1, 'statement_period_id': 1, 'currency_code': 'USD', 'amount': 1.00, 'includes_tax_adjustments': True, }, { 'worksheet_account_contract_closing_balance_id': 2, 'account_id': 2, 'contract_id': 2, 'reference_payment_entity_id': 2, 'abacus_event_id': 2, 'ledger_account_contract_id': 2, 'statement_period_id': 2, 'currency_code': 'USD', 'amount': 2.00, 'includes_tax_adjustments': False, }, ] ), ) total_count = ma.NonNegativeInteger(required=True, example=2) class PaginatedWorksheetAccountContractClosingBalanceInputSchema(PaginationSchema): """Schema for Paginated Worksheet Account Contract Closing Balance Input.""" account_ids = fields.DelimitedList( ma.Integer(validate=[validate.Range(min=1)]), validate=[validate.Length(min=0, max=300)], load_default=[], required=False, example=[1, 2], ) contract_ids = fields.DelimitedList( ma.Integer(validate=[validate.Range(min=1)]), validate=[validate.Length(min=0, max=300)], load_default=[], required=False, example=[1, 2], ) class WorksheetAccountContractClosingBalanceBulkFilterKeySchema(ma.Schema): """Filter key schema for bulk closing balance fetching.""" worksheet_closing_balance_ids = ma.List( ma.Integer(validate=[validate.Range(min=1)]), required=False, validate=[validate.Length(min=1, max=300)], ) class WorksheetAccountContractClosingBalanceBulkFilterParamsPostSchema(ma.Schema): """Post request params for bulk closing balance fetching.""" filters = ma.Nested( WorksheetAccountContractClosingBalanceBulkFilterKeySchema, required=False, ) class WorksheetAccountContractClosingBalanceDataloaderItemSchema(ma.Schema): """Worksheet Account Contract Closing Balance dataloader item schema.""" data = ma.Nested(WorksheetAccountContractClosingBalanceSchema) class WorksheetAccountContractClosingBalanceDataloaderSchema(ma.Schema): """Worksheet Account Contract Closing Balance dataloader schema.""" items = ma.Nested( WorksheetAccountContractClosingBalanceDataloaderItemSchema, many=True )