"""Schemas for Ledger Accounting Run Balance serialization.""" from abacus_common_logic.marshalling.custom_fields import ma from marshmallow import validate class LedgerAccountingRunBalancePostSchema(ma.Schema): """Ledger Accounting Run Balance POST schema.""" abacus_event_id = ma.NonNegativeInteger(required=True) adjusted_net_revenue = ma.Decimal(as_string=True, required=True) contract_id = ma.NonNegativeInteger(required=True) currency_code = ma.NonemptyString(required=True) distribution_fee = ma.Decimal(as_string=True, required=True) mechanical_deduction_admin_fee_total = ma.Decimal(as_string=True, allow_none=True) mechanical_deduction_total = ma.Decimal(as_string=True, allow_none=True) total_gross_revenue_amount = ma.Decimal(as_string=True, required=True) total_net_revenue_amount = ma.Decimal(as_string=True, required=True) class LedgerAccountingRunBalanceDetailSchema(ma.Schema): """Ledger Accounting Run Balance GET schema.""" ledger_accounting_run_balance_id = ma.NonNegativeInteger() abacus_event_id = ma.NonNegativeInteger() account_id = ma.NonNegativeInteger() account_name = ma.NonemptyString() accounting_run_id = ma.NonNegativeInteger() adjusted_net_revenue = ma.Decimal(as_string=True) contract_id = ma.NonNegativeInteger() contract_name = ma.NonemptyString() currency_code = ma.NonemptyString() distribution_fee = ma.Decimal(as_string=True) mechanical_deduction_admin_fee_total = ma.Decimal(as_string=True) mechanical_deduction_total = ma.Decimal(as_string=True) total_gross_revenue_amount = ma.Decimal(as_string=True) total_net_revenue_amount = ma.Decimal(as_string=True) class LedgerAccountingRunBalanceContractCountSchema(ma.Schema): """Ledger Accounting Run Balance Contract Count POST schema.""" accounting_run_id = ma.NonNegativeInteger() contract_count = ma.NonNegativeInteger() class LedgerAccountingRunBalanceVatDetailSchema(LedgerAccountingRunBalanceDetailSchema): """Ledger Accounting Run Balance Vat GET schema.""" country_of_tax_residence = ma.NonemptyString(validate=[validate.Length(equal=3)]) payment_entity_id = ma.NonNegativeInteger() is_vat_exempt = ma.Boolean()