openapi: 3.0.2
info:
  title: SubscriberX Public API
  description: API to allow Subscribers to interact with Hotelier's inventory and any related metadata. It is expected that all requests and responses will be encoded as UTF-8.
  version: 1.0.0
security:
  - BearerAuthorization: []
externalDocs:
  description: Derived from the original OTA specs
  url: https://siteminder.atlassian.net/wiki/spaces/SMX/pages/197680566/Rates+Plans+-+SMX+-+WIP
paths:
  /publishers:
    get:
      description: Get publisher metadata for a subscriber
      tags:
        - Publisher
        - Subscriber
        - Metadata
      responses:
        '200':
          description: OK
          headers:
            X-SM-REFERENCE-ID:
              description: The reference ID used for the request
              schema:
                type: string
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Publisher'
        '401':
          $ref: '#/components/responses/NotAuthorised'
        '403':
          $ref: '#/components/responses/AccessDenied'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/publishers/{publisherCode}/hotels':
    get:
      description: Get hotel metadata for a publisher and subscriber
      tags:
        - Publisher
        - Subscriber
        - Metadata
      parameters:
        - $ref: '#/components/parameters/publisherCodeParam'
      responses:
        '200':
          description: OK
          headers:
            X-SM-REFERENCE-ID:
              description: The reference ID used for the request
              schema:
                type: string
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Hotel'
        '401':
          $ref: '#/components/responses/NotAuthorised'
        '403':
          $ref: '#/components/responses/AccessDenied'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/publishers/{publisherCode}/hotels/{hotelCode}/messages/{messageId}':
    get:
      description: Get the status for a message sent previously
      tags:
        - Metadata
      parameters:
        - $ref: '#/components/parameters/publisherCodeParam'
        - $ref: '#/components/parameters/hotelCodeParam'
        - in: path
          name: messageId
          description: The ID assigned to the original message in format UUID (version 1)
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: OK
          headers:
            X-SM-REFERENCE-ID:
              description: The reference ID used for the request
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - Pending
                      - Error
                      - Delivered
                      - Confirmed
                      - Failed
                    description: The status of the message
                    example: Pending
        '401':
          $ref: '#/components/responses/NotAuthorised'
        '403':
          $ref: '#/components/responses/AccessDenied'
        '404':
          $ref: '#/components/responses/NotFound'
        '405':
          $ref: '#/components/responses/MethodNotAllowed'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/publishers/{publisherCode}/hotels/{hotelCode}/rates':
    post:
      description: Create rate plan and rates for this hotel
      tags:
        - Rates
        - Rate Plans
      parameters:
        - $ref: '#/components/parameters/publisherCodeParam'
        - $ref: '#/components/parameters/hotelCodeParam'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RatePlanCreateModel'
        description: The set of new rates to create for a new rate plan
        required: true
      responses:
        '202':
          description: Accepted
          headers:
            X-SM-REFERENCE-ID:
              description: The reference ID used for the request
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                properties:
                  messageId:
                    allOf:
                      - $ref: '#/components/schemas/MessageId'
                    description: The ID assigned to this create message in format UUID (version 1)
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/NotAuthorised'
        '403':
          $ref: '#/components/responses/AccessDenied'
        '405':
          $ref: '#/components/responses/MethodNotAllowed'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
    put:
      description: Update rate plans and rates for this hotel
      tags:
        - Rates
        - Rate Plans
      parameters:
        - $ref: '#/components/parameters/publisherCodeParam'
        - $ref: '#/components/parameters/hotelCodeParam'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RatePlanUpdateModel'
        description: The set of rates details to update for an existing rate plan
        required: true
      responses:
        '202':
          description: Accepted
          headers:
            X-SM-REFERENCE-ID:
              description: The reference ID used for the request
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                properties:
                  messageId:
                    allOf:
                      - $ref: '#/components/schemas/MessageId'
                    description: The ID assigned to this update message in format UUID (version 1)
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/NotAuthorised'
        '403':
          $ref: '#/components/responses/AccessDenied'
        '405':
          $ref: '#/components/responses/MethodNotAllowed'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/publishers/{publisherCode}/hotels/{hotelCode}/ratePlans':
    get:
      description: Lists all the rate plans for this hotel
      tags:
        - Rate Plans
      parameters:
        - $ref: '#/components/parameters/publisherCodeParam'
        - $ref: '#/components/parameters/hotelCodeParam'
      responses:
        '200':
          description: OK
          headers:
            X-SM-REFERENCE-ID:
              description: The reference ID used for the request
              schema:
                type: string
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RatePlan'
        '401':
          $ref: '#/components/responses/NotAuthorised'
        '403':
          $ref: '#/components/responses/AccessDenied'
        '404':
          $ref: '#/components/responses/NotFound'
        '405':
          $ref: '#/components/responses/MethodNotAllowed'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/publishers/{publisherCode}/hotels/{hotelCode}/ratePlans/{ratePlanCode}':
    get:
      description: Get a specific rate plan for a hotel and publisher
      tags:
        - Rate Plans
      parameters:
        - $ref: '#/components/parameters/publisherCodeParam'
        - $ref: '#/components/parameters/hotelCodeParam'
        - $ref: '#/components/parameters/ratePlanCodeParam'
      responses:
        '200':
          description: OK
          headers:
            X-SM-REFERENCE-ID:
              description: The reference ID used for the request
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RatePlan'
        '401':
          $ref: '#/components/responses/NotAuthorised'
        '403':
          $ref: '#/components/responses/AccessDenied'
        '404':
          $ref: '#/components/responses/NotFound'
        '405':
          $ref: '#/components/responses/MethodNotAllowed'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/publishers/{publisherCode}/hotels/{hotelCode}/ratePlans/{ratePlanCode}/rates':
    get:
      description: Fetch the rates for a rate plan code based on given date range. If fetching rates that are not associated with a rate plan, use the code 'NO_RATE_PLAN_PROVIDED_SM'.
      tags:
        - Rate Plans
        - Rates
      parameters:
        - $ref: '#/components/parameters/publisherCodeParam'
        - $ref: '#/components/parameters/hotelCodeParam'
        - $ref: '#/components/parameters/ratePlanCodeParam'
        - in: query
          name: startDate
          description: Start date to query for rates
          required: true
          schema:
            type: string
            format: date
        - in: query
          name: range
          description: The number of days to query for
          schema:
            type: number
            minimum: 1
            maximum: 30
            default: 1
      responses:
        '200':
          description: OK
          headers:
            X-SM-REFERENCE-ID:
              description: The reference ID used for the request
              schema:
                type: string
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Rate'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/NotAuthorised'
        '403':
          $ref: '#/components/responses/AccessDenied'
        '404':
          $ref: '#/components/responses/NotFound'
        '405':
          $ref: '#/components/responses/MethodNotAllowed'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/publishers/{publisherCode}/hotels/{hotelCode}/roomTypes':
    get:
      description: Lists all the room types for this hotel
      tags:
        - Room Types
      parameters:
        - $ref: '#/components/parameters/publisherCodeParam'
        - $ref: '#/components/parameters/hotelCodeParam'
      responses:
        '200':
          description: OK
          headers:
            X-SM-REFERENCE-ID:
              description: The reference ID used for the request
              schema:
                type: string
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoomType'
        '401':
          $ref: '#/components/responses/NotAuthorised'
        '403':
          $ref: '#/components/responses/AccessDenied'
        '404':
          $ref: '#/components/responses/NotFound'
        '405':
          $ref: '#/components/responses/MethodNotAllowed'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/publishers/{publisherCode}/hotels/{hotelCode}/roomTypes/{roomTypeCode}':
    get:
      description: Get a specific room type for a hotel and publisher
      tags:
        - Room Types
      parameters:
        - $ref: '#/components/parameters/publisherCodeParam'
        - $ref: '#/components/parameters/hotelCodeParam'
        - $ref: '#/components/parameters/roomTypeCodeParam'
      responses:
        '200':
          headers:
            X-SM-REFERENCE-ID:
              description: The reference ID used for the request
              schema:
                type: string
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoomType'
        '401':
          $ref: '#/components/responses/NotAuthorised'
        '403':
          $ref: '#/components/responses/AccessDenied'
        '404':
          $ref: '#/components/responses/NotFound'
        '405':
          $ref: '#/components/responses/MethodNotAllowed'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/publishers/{publisherCode}/hotels/{hotelCode}/availability':
    put:
      description: Update restrictions for this hotel
      tags:
        - Availability
      parameters:
        - $ref: '#/components/parameters/publisherCodeParam'
        - $ref: '#/components/parameters/hotelCodeParam'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestrictionModel'
        description: The set of restrictions to update for this hotel. If both roomTypeCode and ratePlanCode are not provided, the restriction will apply for all rooms in a hotel. Please also note that the end date is not inclusive. For example, if a restriction has a start date of 5th July and end date of 10 July, it will be applied on 5th, 6th, 7th, 8th and 9th July.
        required: true
      responses:
        '202':
          description: Accepted
          headers:
            X-SM-REFERENCE-ID:
              description: The reference ID used for the request
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                properties:
                  messageId:
                    allOf:
                      - $ref: '#/components/schemas/MessageId'
                    description: The ID assigned to this update message in format UUID (version 1)
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/NotAuthorised'
        '403':
          $ref: '#/components/responses/AccessDenied'
        '405':
          $ref: '#/components/responses/MethodNotAllowed'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/publishers/{publisherCode}/hotels/{hotelCode}/roomTypes/{roomTypeCode}/availability':
    get:
      description: Fetch the availability for a given publisher, hotel and room type
      tags:
        - Room Types
        - Availability
      parameters:
        - $ref: '#/components/parameters/publisherCodeParam'
        - $ref: '#/components/parameters/hotelCodeParam'
        - $ref: '#/components/parameters/roomTypeCodeParam'
        - in: query
          name: startDate
          description: Start date to query for availability
          required: true
          schema:
            type: string
            format: date
        - in: query
          name: range
          description: The number of days to query for
          schema:
            type: number
            minimum: 1
            maximum: 30
            default: 1
      responses:
        '200':
          description: OK
          headers:
            X-SM-REFERENCE-ID:
              description: The reference ID used for the request
              schema:
                type: string
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Availability'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/NotAuthorised'
        '403':
          $ref: '#/components/responses/AccessDenied'
        '404':
          $ref: '#/components/responses/NotFound'
        '405':
          $ref: '#/components/responses/MethodNotAllowed'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/publishers/{publisherCode}/hotels/{hotelCode}/ratePlans/{ratePlanCode}/availability':
    get:
      description: Fetch the availability for a given publisher, hotel and rate plan
      tags:
        - Rate Plans
        - Availability
      parameters:
        - $ref: '#/components/parameters/publisherCodeParam'
        - $ref: '#/components/parameters/hotelCodeParam'
        - $ref: '#/components/parameters/ratePlanCodeParam'
        - in: query
          name: startDate
          description: Start date to query for availability
          required: true
          schema:
            type: string
            format: date
        - in: query
          name: range
          description: The number of days to query for
          schema:
            type: number
            minimum: 1
            maximum: 30
            default: 1
      responses:
        '200':
          description: OK
          headers:
            X-SM-REFERENCE-ID:
              description: The reference ID used for the request
              schema:
                type: string
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Availability'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/NotAuthorised'
        '403':
          $ref: '#/components/responses/AccessDenied'
        '404':
          $ref: '#/components/responses/NotFound'
        '405':
          $ref: '#/components/responses/MethodNotAllowed'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
servers:
  - url: /
components:
  parameters:
    publisherCodeParam:
      in: path
      name: publisherCode
      description: Publisher code
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 50
    hotelCodeParam:
      in: path
      name: hotelCode
      description: Hotel code
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 255
    ratePlanCodeParam:
      in: path
      name: ratePlanCode
      description: Rate plan code
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 255
    roomTypeCodeParam:
      in: path
      name: roomTypeCode
      description: Room type code
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 255
  responses:
    NotAuthorised:
      description: Not Authorised
      headers:
        X-SM-REFERENCE-ID:
          description: The reference ID used for the request
          schema:
            type: string
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
            example:
              name: UnauthorizedError
              message: The token has been revoked
    AccessDenied:
      description: Do not have access to the specified resource
      headers:
        X-SM-REFERENCE-ID:
          description: The reference ID used for the request
          schema:
            type: string
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
            example:
              name: UnauthorisedSystemAccess
              message: "Not authorised: you are not authorised to access this property's inventory data"
    NotFound:
      description: Resource does not exist
      headers:
        X-SM-REFERENCE-ID:
          description: The reference ID used for the request
          schema:
            type: string
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
            example:
              name: NotFound
              message: Publisher not found
    InternalServerError:
      description: Internal Server Error
      headers:
        X-SM-REFERENCE-ID:
          description: The reference ID used for the request
          schema:
            type: string
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
            example:
              name: InternalServerError
              message: An error occurred, please try again
    TooManyRequests:
      description: Exceeded API quota for the time period
      headers:
        X-SM-REFERENCE-ID:
          description: The reference ID used for the request
          schema:
            type: string
        RETRY-AFTER:
          description: The time in seconds to retry after
          schema:
            type: integer
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
            example:
              name: TooManyRequestsError
              message: The permitted number of requests has been exceeded, please retry after time period has passed
    BadRequest:
      description: One or more inputs in the request are invalid
      headers:
        X-SM-REFERENCE-ID:
          description: The reference ID used for the request
          schema:
            type: string
      content:
        application/json:
          schema:
            type: object
            properties:
              errors:
                type: array
                items:
                  type: string
                example:
                  - keyword: format
                    message: should match format 'date'
    PayloadTooLarge:
      description: Permitted payload size has been exceeded
      headers:
        X-SM-REFERENCE-ID:
          description: The reference ID used for the request
          schema:
            type: string
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
            example:
              name: PayloadTooLargeError
              message: The permitted size of payload has been exceeded
    MethodNotAllowed:
      description: Operation not supported by the requested resources
      headers:
        X-SM-REFERENCE-ID:
          description: The reference ID used for the request
          schema:
            type: string
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
            example:
              name: MethodNotAllowedError
              message: ARI Delivery not supported by this publisher
  securitySchemes:
    BearerAuthorization:
      type: apiKey
      name: Authorization
      in: header
      description: >
        This API uses JWT for Authentication/Authorisation (please see
        [jwt.io](https://jwt.io) for further details).


        The token can be obtained via the [SMX Subscriber Admin portal](https://exchange.siteminder.com).


        The request header must be in the following format (where 'token' is the encoded JWT string):

        ```

        Authorization: Bearer token

        ```


        The decoded JWT must include the following claims for it to be accepted by the API:

        * iat - Token issued time

        * jti - ID of the token

        * aud - Audience of the token. This API expects the value to be 'subscriberx/api'.

        * sub - Subject of the token. This API expects the value to be the code of the subscriber.


        Example of JWT claims in a decoded token for the subscriber with code 'subscriberCode':

        ```

        {
          'iat': 1576812219,
          'jti': 'e07f7327-490c-4dd7-8d63-c1bdd1f93001',
          'aud': 'subscriberx/api',
          'sub': 'subscriberCode'
        }

        ```
  schemas:
    StringLength1To255:
      type: string
      description: Character strings with length 1 to 255
      minLength: 1
      maxLength: 255
    StringLength1To255ForHotelCode:
      allOf:
        - $ref: '#/components/schemas/StringLength1To255'
      description: Hotel code
    StringLength1To255ForRoomTypeCode:
      allOf:
        - $ref: '#/components/schemas/StringLength1To255'
      description: Room type code
    StringLength1To255ForRoomTypeName:
      allOf:
        - $ref: '#/components/schemas/StringLength1To255'
      description: Name of the room type
    StringLength1To255ForRoomTypeDescription:
      allOf:
        - $ref: '#/components/schemas/StringLength1To255'
      description: Description of the room type
    StringLength1To255ForRatePlanCode:
      allOf:
        - $ref: '#/components/schemas/StringLength1To255'
      description: Rate plan code
    StringLength1To255ForRatePlanName:
      allOf:
        - $ref: '#/components/schemas/StringLength1To255'
      description: Name of the rate plan
    StringLength1To255ForRatePlanDescription:
      allOf:
        - $ref: '#/components/schemas/StringLength1To255'
      description: Description of the rate plan
    StringLength1To255ForCategory:
      allOf:
        - $ref: '#/components/schemas/StringLength1To255'
      description: This is the segment/category to which the rate plan belongs to
    StringLength1To255ForMarketCode:
      allOf:
        - $ref: '#/components/schemas/StringLength1To255'
      description: >
        String attribute to indicate the market code for the rate. Only one
        MarketCode is acceptable for RatePlan code; therefore, the MarketCode
        must be the same for all seasons passed.
    MessageId:
      type: string
      format: uuid
      description: The ID assigned to a message in format UUID (version 1)
      externalDocs:
        description: Universally unique identifier (UUID)
        url: https://en.wikipedia.org/wiki/Universally_unique_identifier
      example: 8cec9446-48d6-11ea-b77f-2e728ce88125
    Error:
      type: object
      description: Contains information on the error encountered
      properties:
        message:
          type: string
          description: Description of the error
        name:
          type: string
          description: Name of the error
    Publisher:
      type: object
      properties:
        name:
          type: string
          description: Publisher name
        code:
          type: string
          description: Publisher code
        messageTypes:
          type: array
          items:
            $ref: '#/components/schemas/MessageType'
          description: Message types supported by the publisher
      required:
        - name
        - code
        - messageTypes
      example:
        name: Publisher Name
        code: PUBLISHERCODE
        messageTypes:
          - Reservation
          - ARI
    Hotel:
      type: object
      properties:
        name:
          type: string
          description: Hotel name
        code:
          $ref: '#/components/schemas/StringLength1To255ForHotelCode'
        currency:
          type: string
          pattern: ^[A-Z]{3}$
          description: ISO 4217 currency codes for the hotel currency
          externalDocs:
            description: ISO 4217 currency codes
            url: https://en.wikipedia.org/wiki/ISO_4217
        timezone:
          type: string
          description: IANA time zone database (tz database) value representing timezone
            for the hotel
          externalDocs:
            description: List of tz database time zones
            url: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
        messageTypes:
          type: array
          items:
            $ref: '#/components/schemas/MessageType'
          description: Message types supported by the hotel
      required:
        - name
        - code
        - currency
        - timezone
        - messageTypes
      example:
        name: Hotel Name
        code: HOTELCODE
        messageTypes:
          - ARI
          - RateCreate
          - RateUpdate
          - RestrictionUpdate
        currency: AUD
        timezone: Australia/Sydney
    MessageType:
      type: string
      description: Message types that may be supported by the publisher or hotel
      enum:
        - Reservations
        - ARI
        - RateCreate
        - RateUpdate
        - RestrictionUpdate
    AgeQualifier:
      type: string
      description: Declares the type of guest
      enum:
        - Infant
        - Child
        - Adult
    BaseGuestAmount:
      type: object
      description: Base charge for a given number of guests for a given age qualifying code
      properties:
        ageQualifier:
          $ref: '#/components/schemas/AgeQualifier'
        guestCount:
          type: integer
          description: Number of guests included in the rate amount
          minimum: 1
        amountBeforeTax:
          type: number
          description: Rate amount exclusive of tax
        amountAfterTax:
          type: number
          description: Rate amount inclusive of tax
      required:
        - ageQualifier
        - guestCount
    AdditionalGuestAmount:
      type: object
      description: Charges related to additional guests
      properties:
        ageQualifier:
          $ref: '#/components/schemas/AgeQualifier'
        amount:
          type: number
          description: This is the tax exclusive rate amount of additional guests
          minimum: 0
    RateStatus:
      type: string
      description: Indicates for each room code passed for the rate whether it is open
        or close
      enum:
        - Close
        - Open
    Rate:
      type: object
      properties:
        date:
          type: string
          format: date
          description: Date of the rate
        currencyCode:
          type: string
          pattern: ^[A-Z]{3}$
          description: ISO 4217 currency codes for the hotel currency
          externalDocs:
            description: ISO 4217 currency codes
            url: https://en.wikipedia.org/wiki/ISO_4217
        roomTypeCode:
          type: string
          description: Indicates the room type code for this rate
        ratePlanCode:
          type: string
          description: Indicates the rate plan code for this rate
        status:
          $ref: '#/components/schemas/RateStatus'
        minLOS:
          type: integer
          description: This is the minimum length of stay requirement associated to the
            rate plan
          minimum: 1
        maxLOS:
          type: integer
          description: This is the maximum length of stay requirement associated to the
            rate plan
          minimum: 1
        baseGuestAmount:
          type: array
          description: Indicates the base guest amount
          items:
            $ref: '#/components/schemas/BaseGuestAmount'
        additionalGuestAmounts:
          type: array
          description: Indicates the additional guest amount for each age qualifier
          items:
            $ref: '#/components/schemas/AdditionalGuestAmount'
        lastModifiedAt:
          type: string
          description: The last time when this rate was modified
          format: date-time
      required:
        - date
        - currencyCode
        - roomTypeCode
        - ratePlanCode
        - status
        - baseGuestAmount
    RateUpdateModel:
      type: object
      properties:
        startDate:
          type: string
          format: date
          description: Start date of the rate
        endDate:
          type: string
          format: date
          description: End date of the rate, the rate date range is not inclusive of the end date.
        status:
          $ref: '#/components/schemas/RateStatus'
        roomTypes:
          type: array
          description: Room types applicable to this rate
          items:
            $ref: '#/components/schemas/RoomTypeModel'
          minItems: 1
        baseGuestAmount:
          type: array
          description: Indicates the base guest amount
          items:
            $ref: '#/components/schemas/BaseGuestAmount'
          minItems: 1
        additionalGuestAmounts:
          type: array
          description: Indicates the additional guest amount for each age qualifier
          items:
            $ref: '#/components/schemas/AdditionalGuestAmount'
      required:
        - startDate
        - endDate
        - status
        - roomTypes
        - baseGuestAmount
    RateCreateModel:
      allOf:
        - type: object
          properties:
            currencyCode:
              type: string
              pattern: ^[A-Z]{3}$
              description: ISO 4217 currency codes for the hotel currency
              externalDocs:
                description: ISO 4217 currency codes
                url: https://en.wikipedia.org/wiki/ISO_4217
        - $ref: '#/components/schemas/RateUpdateModel'
      required:
        - currencyCode
    RoomTypeModel:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/StringLength1To255ForRoomTypeCode'
      required:
        - code
    RoomType:
      type: object
      allOf:
        - $ref: '#/components/schemas/RoomTypeModel'
        - type: object
          properties:
            names:
              type: array
              description: Name of the room type in different languages
              items:
                type: object
                properties:
                  lang:
                    type: string
                    pattern: ^[a-z]{2}$
                    description: ISO 639-1 language codes for the name
                    externalDocs:
                      description: ISO 639-1 language codes
                      url: https://en.wikipedia.org/wiki/ISO_639-1
                  name:
                    $ref: '#/components/schemas/StringLength1To255ForRoomTypeName'
            descriptions:
              type: array
              description: Description of the room type in different languages
              items:
                type: object
                properties:
                  lang:
                    type: string
                    pattern: ^[a-z]{2}$
                    description: ISO 639-1 language codes for the name
                    externalDocs:
                      description: ISO 639-1 language codes
                      url: https://en.wikipedia.org/wiki/ISO_639-1
                  description:
                    $ref: '#/components/schemas/StringLength1To255ForRoomTypeDescription'
            lastModifiedAt:
              type: string
              description: The last time when this room type was modified
              format: date-time
    WeekDays:
      type: string
      description: Days of the week
      enum:
        - Mon
        - Tue
        - Wed
        - Thur
        - Fri
        - Sat
        - Sun
    RatePlanBaseModel:
      type: object
      properties:
        category:
          $ref: '#/components/schemas/StringLength1To255ForCategory'
        yieldable:
          type: boolean
          description: >
            Boolean attribute to indicate whether the rate is yieldable or not.
            Only one Yieldable indicator is acceptable for RatePlan code;
            therefore, the Yieldable indicator must be the same for all seasons
            passed.
        marketCode:
          $ref: '#/components/schemas/StringLength1To255ForMarketCode'
        confidential:
          type: boolean
          description: Boolean attribute to indicate if the rate is to be considered
            “Confidential”
        commissionable:
          type: boolean
          description: >
            This indicates whether the rate season is commissionable or not. If
            the Boolean is sent as False, the rate season is not commissionable.
            If the Boolean is set to True, but NO commission is sent in the
            commission element, then the commission to be applied is the default
            one for the property. If the Boolean is set to True and a commission
            is passed in the field then the commission sent is the one applied
            to the rate season.
        names:
          type: array
          description: Names of the rate plan in different languages
          items:
            type: object
            properties:
              lang:
                type: string
                pattern: ^[a-z]{2}$
                description: ISO 639-1 language codes for the name
                externalDocs:
                  description: ISO 639-1 language codes
                  url: https://en.wikipedia.org/wiki/ISO_639-1
              name:
                $ref: '#/components/schemas/StringLength1To255ForRatePlanName'
        descriptions:
          type: array
          description: Descriptions of the rate plan in different languages
          items:
            type: object
            properties:
              lang:
                type: string
                pattern: ^[a-z]{2}$
                description: ISO 639-1 language codes for the name
                externalDocs:
                  description: ISO 639-1 language codes
                  url: https://en.wikipedia.org/wiki/ISO_639-1
              description:
                $ref: '#/components/schemas/StringLength1To255ForRatePlanDescription'
        commission:
          type: object
          description: This indicates how the commission is calculated if it is commissionable. It can be either a fixed amount or by percentage but not both.
          properties:
            percentage:
              type: number
              format: double
              description: Commission percentage
              minimum: 0
              maximum: 100
            amount:
              type: number
              format: double
              description: Commission amount
        minimumAdvancedBookingOffset:
          type: integer
          description: This is the minimum amount of days prior to arrival that the rate can be booked
          minimum: 0
        maximumAdvancedBookingOffset:
          type: integer
          description: This is the maximum amount of days prior to arrival that the rate can be booked
          minimum: 0
        minLOS:
          type: integer
          minimum: 1
          description: This is the minimum length of stay requirement associated to the rate plan
        maxLOS:
          type: integer
          minimum: 1
          description: This is the maximum length of stay requirement associated to the rate plan
        arrivalWeekDays:
          type: array
          description: Set of days of the week that arrival is allowed
          items:
            $ref: '#/components/schemas/WeekDays'
        availableWeekDays:
          type: array
          description: Set of days of the week which the rate plan is available and therefore could be used to reflect when the stay is possible
          items:
            $ref: '#/components/schemas/WeekDays'
    RatePlan:
      allOf:
        - type: object
          properties:
            code:
              type: string
              description: Rate plan code
            start:
              type: string
              format: date
              description: Start of sell date
            end:
              type: string
              format: date
              description: End of sell date, the rate plan date range is not inclusive of the end date.
            lastModifiedAt:
              type: string
              format: date-time
              description: The last time when this rate plan was modified
        - $ref: '#/components/schemas/RatePlanBaseModel'
      required:
        - code
    RatePlanCreateModel:
      allOf:
        - type: object
          properties:
            code:
              type: string
              description: Rate plan code
              pattern: ^[A-Za-z0-9-_]{1,8}$
            start:
              type: string
              format: date
              description: Start of sell date
            end:
              type: string
              format: date
              description: End of sell date, the rate plan date range is not inclusive of the end date.
            rates:
              type: array
              description: Rates for this rate plan
              items:
                $ref: '#/components/schemas/RateCreateModel'
              minItems: 1
              maxItems: 30
        - $ref: '#/components/schemas/RatePlanBaseModel'
      required:
        - code
        - start
        - end
        - rates
    RatePlanUpdateModel:
      allOf:
        - type: object
          properties:
            code:
              $ref: '#/components/schemas/StringLength1To255ForRatePlanCode'
            start:
              type: string
              format: date
              description: Start of sell date
            end:
              type: string
              format: date
              description: End of sell date, the rate plan date range is not inclusive of the end date.
            rates:
              type: array
              description: Rates for this rate plan
              items:
                $ref: '#/components/schemas/RateUpdateModel'
              minItems: 1
              maxItems: 30
        - $ref: '#/components/schemas/RatePlanBaseModel'
      required:
        - code
        - start
        - end
        - rates
    Availability:
      type: object
      properties:
        bookingLimit:
          type: integer
          description: The number of rooms available
          minimum: 0
        date:
          type: string
          description: Date of the availability
          format: date
        ratePlanCode:
          type: string
          description: Rate plan code
        roomTypeCode:
          type: string
          description: Room type code
        minLOS:
          type: integer
          description: This is the minimum length of stay requirement associated to the rate plan
          minimum: 1
        maxLOS:
          type: integer
          description: This is the maximum length of stay requirement associated to the rate plan
          minimum: 1
        restriction:
          $ref: '#/components/schemas/Restriction'
        status:
          $ref: '#/components/schemas/RestrictionStatus'
        lastModifiedAt:
          type: string
          description: The last time when this availability was modified
          format: date-time
      required:
        - date
    Restriction:
      type: string
      description: Type of restriction
      enum:
        - Master
        - Arrival
        - Departure
        - NonGuarantee
        - TravelAgent
        - Company
    RestrictionStatus:
      type: string
      description: Status of the restriction
      enum:
        - Open
        - Close
        - OnRequest
    RestrictionModel:
      type: object
      properties:
        startDate:
          type: string
          format: date
          description: Start date of the restriction
        endDate:
          type: string
          format: date
          description: End date of the restriction, the date range is not inclusive of the end date.
        ratePlanCode:
          $ref: '#/components/schemas/StringLength1To255ForRatePlanCode'
        roomTypeCode:
          $ref: '#/components/schemas/StringLength1To255ForRoomTypeCode'
        minLOS:
          type: integer
          description: This is the minimum length of stay requirement associated to the rate plan
          minimum: 1
        maxLOS:
          type: integer
          description: This is the maximum length of stay requirement associated to the rate plan
          minimum: 1
        restriction:
          $ref: '#/components/schemas/Restriction'
        status:
          $ref: '#/components/schemas/RestrictionStatus'
      oneOf:
        - required: [minLOS]
        - required: [maxLOS]
        - required: [restriction, status]
      required:
        - startDate
        - endDate
