"""Accounting Run marshmallow schema.""" from abacus_common_logic.marshalling.custom_fields import ma from royalties.constants.constants import ACCOUNTING_RUN_STATUSES class AccountingRunSchema(ma.Schema): """Accounting Run detail response.""" accounting_period_name = ma.Pluck( 'AccountingPeriodDetailSchema', 'accounting_period_name', attribute='accounting_period', ) accounting_run_id = ma.IntegerId() accounting_run_status = ma.Enum( options=ACCOUNTING_RUN_STATUSES, attribute='run_status', required=True ) accounting_period_id = ma.NonNegativeInteger(required=True) run_controller_id = ma.NonNegativeInteger(required=True) run_controller_name = ma.Pluck( 'RunControllerDetailSchema', 'run_controller_name', attribute='run_controller' ) start_date = ma.FormattedDate(allow_none=True) end_date = ma.FormattedDate(allow_none=True) summary_export_url = ma.NonemptyString()