openapi: 3.0.0
info:
  version: 1.0.0
  title: Check In Service API
  description: Pass Check In and Check Out Information to CLC
servers:
  - description: Mock Server
    url: https://c3a1ba49-c2e4-4e2f-829e-1195823e9d09.mock.pstmn.io
paths:
  /api/v1/reservation/checkin:
    post:
      summary: Check In
      description: Pass all relevant check in infomation to check in a guest
      tags:
        - reservation
      requestBody:
        description: Check In
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckInRequest'
            example:
              employeeIdentifier: '1234345'
              supplierReservationId: '1234'
              source: HOS
              checkInDateTime: '2024-10-17T14:30:00-05:00'
              roomNumber: '204'
              folioNumber: '204'
              guestFirstName: Ada
              guestLastName: Lovelace
              loyalty: hhonors
              numberOfNights: 2
      responses:
        '200':
          description: Request Processed Successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessfulResponse'
              example:
                status: checked_in
        '202':
          description: Request has been added the the queue
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessfulResponse'
              example:
                requestId: 42d3913c-4794-4cfd-813c-f7ea9e4240bb
                status: check_in_in_progress
        '400':
          description: Bad Request (400)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
              example:
                message: Invalid request. Please check your request data
        '500':
          description: Unexpected Error (500)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
              example:
                message: An unexpected error occurred
  /api/v1/reservation/checkout:
    post:
      summary: Check Out
      description: Pass all relevant check out infomation to check out a guest
      tags:
        - reservation
      requestBody:
        description: Check Out Request
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckOutRequest'
            example:
              employeeIdentifier: '1234345'
              supplierReservationId: '1234'
              checkOutDateTime: '2025-10-17T14:30:00-05:00'
              roomNumber: '204'
              folioNumber: '204'
              guestFullName: Ada Lovelace
              checkInDateTime: '2024-10-17T14:30:00-05:00'
      responses:
        '200':
          description: Request Processed Successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessfulResponse'
              example:
                status: checked_out
        '202':
          description: Request has been added the the queue
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessfulResponse'
              example:
                requestId: 42d3913c-4794-4cfd-813c-f7ea9e4240bb
                status: check_out_in_progress
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
              example:
                message: Invalid request. Please check your request data
        '404':
          description: Not Found (404)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
              example:
                message: The resource with the provided Request Id was not found
        '500':
          description: Unexpected Error (500)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
              example:
                message: An unexpected error occurred
  /api/v1/reservation/status/{requestId}:
    get:
      summary: Get Status of Reservation
      description: Endpoint to Get the Status of a Reservation
      tags:
        - reservation
      parameters:
        - name: requestId
          in: path
          required: true
          schema:
            type: string
            example: bb8350fc-dce1-41a1-91b1-91b0d64b5eeb
      responses:
        '200':
          description: Request Processed Successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessfulResponse'
              example:
                employeeIdentifier: '123456789'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
              example:
                message: Invalid requestId format. The requestId should be a valid UUID
        '404':
          description: Not Found (404)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
              example:
                message: The resource with the provided Request Id was not found
        '500':
          description: Unexpected Error (500)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
              example:
                message: An unexpected error occurred
components:
  schemas:
    CheckInRequest:
      type: object
      required:
        - supplierReservationId
        - source
        - checkInDateTime
        - roomNumber
        - folioNumber
        - guestFirstName
        - guestLastName
        - numberOfNights
      properties:
        employeeIdentifier:
          type: string
        supplierReservationId:
          type: string
        source:
          type: string
          description: The source from which the booking came from
        checkInDateTime:
          $ref: '#/components/schemas/DateTimeOffset'
        roomNumber:
          type: string
        folioNumber:
          type: string
        guestFirstName:
          type: string
        guestLastName:
          type: string
        roomType:
          type: string
        expectedCheckOutDateTime:
          type: string
        reservationInformation:
          type: object
        loyalty:
          type: string
          description: The loyalty number assigned or credited with the reservation
        occupancy:
          type: integer
        numberOfNights:
          type: integer
    CheckOutRequest:
      type: object
      required:
        - checkOutDateTime
        - supplierReservationId
        - roomNumber
        - folioNumber
        - guestFirstName
        - guestLastName
        - checkInDateTime
        - occupancy
      properties:
        employeeIdentifier:
          type: string
        supplierReservationId:
          type: string
        checkInDateTime:
          $ref: '#/components/schemas/DateTimeOffset'
        roomNumber:
          type: string
        folioNumber:
          type: string
        guestFirst:
          type: string
        guestLastName:
          type: string
        totalNumberOfNights:
          type: integer
        occupancy:
          type: integer
    DateTimeOffset:
      type: string
      format: date-time
      description: Date and time with timezone offset, e.g., 2024-10-17T14:30:00-05:00
      example: '2024-10-17T14:30:00-05:00'
      pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\+|\-)\d{2}:\d{2}$
    SuccessfulResponse:
      type: object
      properties:
        status:
          type: string
    BadRequestError:
      type: object
      required:
        - message
      properties:
        message:
          type: string
    NotFoundError:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          example: Item with the provided Reservation Id was not found
    InternalServerError:
      type: object
      required:
        - message
      properties:
        message:
          description: Internal Server Error
          type: string
  responses:
    Successful:
      description: Successful Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SuccessfulResponse'
    BadRequest:
      description: Invalid input
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BadRequestError'
    InternalServerError:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InternalServerError'
    NotFound:
      description: Reservation Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NotFoundError'
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-Api-Key
security:
  - ApiKey: []
