
components:

    schemas:

        HsOfficeDebitor:
            type: object
            properties:
                uuid:
                    type: string
                    format: uuid
                debitorRel:
                    $ref: 'hs-office-relation-schemas.yaml#/components/schemas/HsOfficeRelation'
                debitorNumber:
                    type: string
                    pattern: 'D-[0-9]{7}'
                debitorNumberSuffix:
                    type: string
                    pattern: '^[0-9][0-9]$'
                partner:
                    $ref: 'hs-office-partner-schemas.yaml#/components/schemas/HsOfficePartner'
                billable:
                    type: boolean
                vatId:
                   type: string
                vatCountryCode:
                   type: string
                   pattern: '^[A-Z][A-Z]$'
                vatBusiness:
                   type: boolean
                vatReverseCharge:
                   type: boolean
                refundBankAccount:
                    $ref: 'hs-office-bankaccount-schemas.yaml#/components/schemas/HsOfficeBankAccount'
                defaultPrefix:
                    type: string
                    pattern: '^[a-z0-9]{3}$'

        HsOfficeDebitorPatch:
            type: object
            properties:
                debitorRel.uuid:
                    type: string
                    format: uuid
                    nullable: true
                billable:
                    type: boolean
                    nullable: false
                vatId:
                    type: string
                    nullable: true
                vatCountryCode:
                    type: string
                    pattern: '^[A-Z][A-Z]$'
                    nullable: true
                vatBusiness:
                    type: boolean
                    nullable: false
                vatReverseCharge:
                    type: boolean
                    nullable: false
                refundBankAccount.uuid:
                    type: string
                    format: uuid
                    nullable: true
                defaultPrefix:
                    type: string
                    pattern: '^[a-z0-9]{3}$'
                    nullable: true

        HsOfficeDebitorInsert:
            type: object
            properties:
                debitorRel:
                    $ref: 'hs-office-relation-schemas.yaml#/components/schemas/HsOfficeRelationSubInsert'
                debitorRel.uuid:
                    type: string
                    format: uuid
                debitorNumberSuffix:
                    type: string
                    pattern: '^[0-9][0-9]$'
                billable:
                    type: boolean
                vatId:
                    type: string
                vatCountryCode:
                    type: string
                    pattern: '^[A-Z][A-Z]$'
                vatBusiness:
                    type: boolean
                vatReverseCharge:
                    type: boolean
                # TODO.feat: alternatively the complete refundBankAccount
                refundBankAccount.uuid:
                    type: string
                    format: uuid
                defaultPrefix:
                    type: string
                    pattern: '^[a-z]{3}$'
            required:
              - debitorNumberSuffix
              - defaultPrefix
              - billable
