
components:

    schemas:

        HsOfficeMembershipStatus:
            type: string
            enum:
                - INVALID
                - ACTIVE
                - CANCELLED
                - TRANSFERRED
                - DECEASED
                - LIQUIDATED
                - EXPULSED
                - UNKNOWN

        HsOfficeMembership:
            type: object
            properties:
                uuid:
                    type: string
                    format: uuid
                partner:
                    $ref: 'hs-office-partner-schemas.yaml#/components/schemas/HsOfficePartner'
                mainDebitor:
                    $ref: 'hs-office-debitor-schemas.yaml#/components/schemas/HsOfficeDebitor'
                memberNumber:
                    type: string
                    minLength: 9
                    maxLength: 9
                    pattern: 'M-[0-9]{7}'
                memberNumberSuffix:
                    type: string
                    minLength: 2
                    maxLength: 2
                    pattern: '[0-9]+'
                validFrom:
                   type: string
                   format: date
                validTo:
                   type: string
                   format: date
                status:
                   $ref: '#/components/schemas/HsOfficeMembershipStatus'
                membershipFeeBillable:
                    type: boolean

        HsOfficeMembershipPatch:
            type: object
            properties:
                validTo:
                    type: string
                    format: date
                    nullable: true
                status:
                    $ref: '#/components/schemas/HsOfficeMembershipStatus'
                membershipFeeBillable:
                    nullable: true
                    type: boolean
            additionalProperties: false

        HsOfficeMembershipInsert:
            type: object
            properties:
                partner.uuid:
                    type: string
                    format: uuid
                    nullable: false
                memberNumberSuffix:
                    type: string
                    minLength: 2
                    maxLength: 2
                    pattern: '[0-9]+'
                    nullable: false
                validFrom:
                    type: string
                    format: date
                    nullable: false
                validTo:
                    type: string
                    format: date
                    nullable: true
                status:
                    $ref: '#/components/schemas/HsOfficeMembershipStatus'
                membershipFeeBillable:
                    nullable: false
                    type: boolean
            required:
                - partner.uuid
                - memberNumberSuffix
                - validFrom
                - membershipFeeBillable
            additionalProperties: false
