
components:

    schemas:

        HsBookingItemType:
            type: string
            enum:
                - PRIVATE_CLOUD
                - CLOUD_SERVER
                - MANAGED_SERVER
                - MANAGED_WEBSPACE
                - DOMAIN_SETUP

        HsBookingItem:
            type: object
            properties:
                uuid:
                    type: string
                    format: uuid
                type:
                    $ref: '#/components/schemas/HsBookingItemType'
                caption:
                    type: string
                validFrom:
                   type: string
                   format: date
                validTo:
                   type: string
                   format: date
                resources:
                    $ref: '#/components/schemas/BookingResources'
            required:
                - uuid
                - validFrom
                - validTo
                - resources

        HsBookingItemPatch:
            type: object
            properties:
                caption:
                    type: string
                    nullable: true
                validTo:
                    type: string
                    format: date
                    nullable: true
                resources:
                    $ref: '#/components/schemas/BookingResources'
            additionalProperties: false

        HsBookingItemInsert:
            type: object
            properties:
                project.uuid:
                    type: string
                    format: uuid
                    nullable: false
                parentItem.uuid:
                    type: string
                    format: uuid
                    nullable: false
                type:
                    $ref: '#/components/schemas/HsBookingItemType'
                caption:
                    type: string
                    minLength: 3
                    maxLength: 80
                    nullable: false
                validTo:
                    type: string
                    format: date
                    nullable: true
                resources:
                    $ref: '#/components/schemas/BookingResources'
                hostingAsset:
                    $ref: '../hs-hosting/hs-hosting-asset-schemas.yaml#/components/schemas/HsHostingAssetAutoInsert'
            required:
                - caption
                - project.uuid
                - validFrom
                - resources
            additionalProperties: false

        BookingResources:
            anyOf:
                - $ref: '#/components/schemas/ManagedServerBookingResources'
                - $ref: '#/components/schemas/ManagedWebspaceBookingResources'

        ManagedServerBookingResources:
            type: object
            properties:
                CPU:
                    type: integer
                    minimum: 1
                    maximum: 16
                SSD:
                    type: integer
                    minimum: 16
                    maximum: 4096
                HDD:
                    type: integer
                    minimum: 16
                    maximum: 4096
            additionalProperties: false

        ManagedWebspaceBookingResources:
            type: object
            properties:
                disk:
                    type: integer
                    minimum: 1
                    maximum: 16
                SSD:
                    type: integer
                    minimum: 16
                    maximum: 4096
                HDD:
                    type: integer
                    minimum: 16
                    maximum: 4096
            additionalProperties: false

