"""Schemas for Ledger Adjustment Applied serialization.""" from abacus_common_logic.marshalling.custom_fields import ma class LedgerAdjustmentDetailAppliedPostSchema(ma.Schema): """Ledger Adjustment Detail Applied POST schema.""" # TODO: Remove this column when ledger adjustment and detail tables are dropped ledger_adjustment_detail_id = ma.NonNegativeInteger(required=False, allow_none=True) # TODO: Update worksheet_adjustment_id and worksheet_adjustment_detail_id # to non-nullable worksheet_adjustment_id = ma.NonNegativeInteger(required=False, allow_none=True) worksheet_adjustment_detail_id = ma.NonNegativeInteger( required=False, allow_none=True ) adjustment_currency_code = ma.NonemptyString() adjustment_amount = ma.Decimal(as_string=True) adjustment_payee_currency_code = ma.NonemptyString() adjustment_amount_payee_currency = ma.Decimal(as_string=True) apply_to_flowthrough_payment = ma.Boolean(required=False, allow_none=True) class LedgerAdjustmentAppliedPostSchema(ma.Schema): """Ledger Adjustment Applied POST schema.""" abacus_event_id = ma.NonNegativeInteger(required=True) account_id = ma.NonNegativeInteger(required=True) contract_id = ma.NonNegativeInteger(required=False, allow_none=True) statement_period_id = ma.NonNegativeInteger(required=True) # TODO: Remove this column when ledger adjustment and detail tables are dropped ledger_adjustment_id = ma.NonNegativeInteger(required=False, allow_none=True) # TODO: update it to required=True worksheet_adjustment_id = ma.NonNegativeInteger(required=False, allow_none=True) adjustment_currency_code = ma.NonemptyString() adjustment_amount = ma.Decimal(as_string=True) adjustment_amount_payee_currency = ma.Decimal(as_string=True) adjustment_payee_currency_code = ma.NonemptyString() apply_to_flowthrough_payment = ma.Boolean(required=False, allow_none=True) details = ma.List( ma.Nested(LedgerAdjustmentDetailAppliedPostSchema), required=False )