"""ReferenceSigningEntity marshmallow schema.""" from abacus_common_logic.marshalling.custom_fields import ma from marshmallow import fields from abacus_contract.constants.constants import ( DEFAULT_PAGE_LIMIT, DEFAULT_PAGE_OFFSET, SIGNING_ENTITY_SORT_OPTIONS, SORT_ORDER_OPTIONS, ) class ReferenceSigningEntitySchema(ma.Schema): """ReferenceSigningEntity schema.""" class Meta: """Meta data class.""" title = 'ReferenceSigningEntity Detail' example = { 'reference_signing_entity_id': 1, 'reference_payment_entity_id': 1, 'company_code': '4914', 'legal_name': 'AWAL Digital Limited', 'vat_number': 'GB 423 4787 86', 'company_registration_number': '04430703', 'address': '2 Canal Reach London N1C 4DB', } reference_signing_entity_id = ma.IntegerId( required=True, description='id of the reference_signing_entity' ) reference_sap_profit_center_id = ma.IntegerId(required=True) reference_payment_entity_id = ma.IntegerId( required=True, description='id of the related reference_payment_entity' ) company_code = ma.NonemptyString( required=True, description='4 digit code used for financial reporting and for issuing KNR payments', ) tax_entity_company_code = ma.NonemptyString( required=False, description='4 digit code used for financial reporting and for issuing KNR payments', ) legal_name = ma.NonemptyString( required=True, description='name of the signing entity' ) vat_number = ma.NonemptyString( required=False, description='registered tax identification number' ) company_registration_number = ma.NonemptyString( required=False, description='registration number of the company' ) address = ma.NonemptyString(required=False, description='address of the company') class ReferenceSigningEntityListResponseSchema(ma.Schema): """ReferenceSigningEntity list schema.""" items = ma.Nested(ReferenceSigningEntitySchema, many=True) total_count = ma.Integer(required=True) class ReferenceSigningEntityDataloaderSchema(ma.Schema): """Schema for wrapping a collection of Signing Entity.""" data = fields.Nested( ReferenceSigningEntitySchema, many=True, allow_none=True, ) class ReferenceSigningEntityFilterSchema(ma.Schema): """Reference Signing Entity List filter schema.""" limit = ma.NonNegativeInteger(missing=500) offset = ma.NonNegativeInteger(missing=DEFAULT_PAGE_OFFSET) sort_by = ma.Enum( options=SIGNING_ENTITY_SORT_OPTIONS, load_default=SIGNING_ENTITY_SORT_OPTIONS.COMPANY_CODE, ) sort_order = ma.Enum( options=SORT_ORDER_OPTIONS, load_default=SORT_ORDER_OPTIONS.ASC )