swagger: '2.0'
info:
  title: Ows-timed-release API specifications
  version: 0.0.1
host: qa-ows-timed-release.theorchard.io
basePath: /
schemes:
  - https
tags:
  - name: Health Check
    description: Check the health of the application.
  - name: Timed Release CRUD Operation
    description: Following are Timed Release Schedule CRUD Operation.
paths:
  /hello:
    get:
      tags:
        - Health Check
      description: Health check
      summary: Check the health of the application.
      responses:
        '200':
          description: 200 OK
          schema:
            $ref: '#/definitions/hello'
  /product/{product_id}:
    get:
      parameters:
        - in: path
          name: product_id
          required: true
          type: integer
      responses:
        '200':
          description: 200 OK
          schema:
            $ref: '#/definitions/200GetResponse'
        '404':
          description: 404 Product not found
          schema:
            $ref: '#/definitions/404Response'
        '400':
          description: 400 Bad request
          schema:
            $ref: '#/definitions/400GetResponse'
        '500':
          description: 500 Internal server error
          schema:
            $ref: '#/definitions/500Response'
      description: Get product live time detail for given product id.
      summary: Returns product live time detail.
      tags:
        - Timed Release CRUD Operation
    put:
      parameters:
        - in: header
          name: Correlation-Id
          required: false
          type: string
        - in: path
          name: product_id
          required: true
          type: integer
        - in: body
          name: body
          schema:
            $ref: '#/definitions/requestBodyForPutAndPost'
      responses:
        '200':
          description: 200 OK
          schema:
            $ref: '#/definitions/200PutResponse'
        '404':
          description: 404 Product not found
          schema:
            $ref: '#/definitions/404Response'
        '400':
          description: 400 Bad request
          schema:
            $ref: '#/definitions/400PutAndPostResponse'
        '500':
          description: 500 Internal server error
          schema:
            $ref: '#/definitions/500Response'
      description: Update product live time detail for given product id.
      summary: Returns success message on update.
      tags:
        - Timed Release CRUD Operation
    delete:
      parameters:
        - in: path
          name: product_id
          required: true
          type: integer
      responses:
        '200':
          description: 200 OK
          schema:
            $ref: '#/definitions/200DeleteResponse'
        '404':
          description: 404 Product not found
          schema:
            $ref: '#/definitions/404Response'
        '400':
          description: 400 Bad request
          schema:
            $ref: '#/definitions/400DeleteResponse'
        '500':
          description: 500 Internal server error
          schema:
            $ref: '#/definitions/500Response'
      description: Delete product live time detail for given product id.
      summary: Returns success message on delete.
      tags:
        - Timed Release CRUD Operation
  /product:
    post:
      parameters:
        - in: header
          name: Correlation-Id
          required: false
          type: string
        - in: body
          name: body
          schema:
            $ref: '#/definitions/requestBodyForPutAndPost'
      responses:
        '200':
          description: 200 OK
          schema:
            $ref: '#/definitions/200PostResponse'
        '400':
          description: 400 Bad request
          schema:
            $ref: '#/definitions/400PutAndPostResponse'
        '500':
          description: 500 Internal server error
          schema:
            $ref: '#/definitions/500Response'
      description: Save info about product live time detail.
      summary: Create product live time detail.
      tags:
        - Timed Release CRUD Operation
definitions:
  500Response:
    description: 500 Internal server error
    type: object
    properties:
      code:
        type: string
        example: server_error
      message:
        type: string
        example: Could not connect to MySQL.
    required:
      - message
      - code
  404Response:
    description: 404 Product not found
    type: object
    properties:
      code:
        type: string
        example: not_found_error
      message:
        type: string
        example: Requested product id <product_id> not found.
    required:
      - message
      - code
  200GetResponse:
    description: 200 OK
    type: object
    properties:
      product_id:
        type: integer
      time_of_day_product:
        type: string
      time_zone:
        type: string
      store_ids:
        type: array
        items:
          type: integer
    required:
      - product_id
      - time_of_day_product
      - time_zone
      - store_ids
    example:
      product_id: 2080168
      time_of_day_product: '20:15:00'
      time_zone: local
      store_ids: [4, 286]
  200PutResponse:
    description: 200 OK
    type: object
    properties:
      message:
        type: string
    required:
      - message
    example: Product live time successfully updated for product id <product_id>
  200DeleteResponse:
    description: 200 OK
    type: object
    properties:
      message:
        type: string
    required:
      - message
    example: Successfully deleted the Timed Release Data.
  200PostResponse:
    description: 200 OK
    type: object
    properties:
      product:
        type: array
        items:
          type: object
          properties:
            product_id:
              type: integer
            time_of_day_product:
              type: string
            time_zone:
              type: string
            store_ids:
              type: array
              items:
                type: integer
          required:
            - product_id
            - time_of_day_product
            - time_zone
            - store_ids
    required:
      - product
    example:
      product:
        product_id: 2080168
        time_of_day_product: '20:15:00'
        time_zone: 'local'
        store_ids: [4, 286]
  400GetResponse:
    description: 400 Bad request
    type: object
    properties:
      code:
        type: string
        example: bad_request
      message:
        type: string
        example: <product_id> must be integer and greater than zero
    required:
      - message
      - code
  400PutAndPostResponse:
    description: 400 Bad request
    type: object
    properties:
      code:
        type: string
      message:
        type: string
    required:
      - message
      - code
    example:
      message: The body contains the fields that did not pass validation with a validation context message
      code: body_validation_error
  400DeleteResponse:
    description: 400 Bad request
    type: object
    properties:
      code:
        type: string
      message:
        type: string
    required:
      - message
      - code
    example:
      message: <product_id> must be integer and greater than zero
      code: bad_request
  hello:
    type: object
    properties:
      status:
        type: string
    example:
      status: ok
  requestBodyForPutAndPost:
    type: object
    properties:
      product_id:
        type: integer
      time_of_day_product:
        type: string
      time_zone:
        type: string
      store_ids:
        type: array
        items:
          type: integer
    required:
      - product_id
      - time_of_day_product
      - time_zone
      - store_ids
    example:
      product_id: 2080168
      time_of_day_product: '02:22:23'
      time_zone: 'GMT'
      store_ids: [4, 286]
securityDefinitions: {}
