"""Account Tax Info History marshmallow schemas.""" from abacus_common_logic.marshalling.custom_fields import ma from marshmallow import validate from abacus_account.constants.constants import TAX_EMPLOYMENT_TYPES class AccountTaxInfoHistorySchema(ma.Schema): """Account tax info history fields.""" account_tax_info_history_id = ma.IntegerId(required=True) account_tax_info_id = ma.IntegerId(required=True) account_id = ma.IntegerId(required=True) country_of_tax_residence = ma.NonemptyString( required=True, allow_none=True, validate=[validate.Length(equal=3)] ) is_sba_signed = ma.Boolean() is_vat_exempt = ma.Boolean() is_tax_treaty_claimed = ma.Boolean() tax_employment_type = ma.Enum(options=TAX_EMPLOYMENT_TYPES, allow_none=True) certificate_of_residence_expiration_date = ma.FormattedDate(allow_none=True) is_wht_applicable = ma.Boolean() is_resident_of_spanish_islands = ma.Boolean(allow_none=True) wht_rate_override = ma.Decimal(as_string=True, allow_none=True) created_at = ma.FormattedDate(required=True) last_modified = ma.FormattedDate(required=True)