swagger: '2.0'
info:
  title: ows-content-review
  version: 0.0.1
host: qa-ows-content-review.theorchard.io
basePath: /
schemes:
  - https
paths:
  /mena/products:
    put:
      summary: Bulk update tool
      parameters:
        - description: Orchard User Id
          in: header
          name: Orchard-User-Id
          required: true
          type: string
        - in: body
          name: body
          schema:
            $ref: '#/definitions/CreateMenaProducts'
      responses:
        '201':
          description: '201'
          schema:
            $ref: '#/definitions/Response201'
        '400':
          description: '400'
          schema:
            $ref: '#/definitions/Response400'
        '403':
          description: '403'
          schema:
            $ref: '#/definitions/Response403'
        '500':
          description: '500'
          schema:
            $ref: '#/definitions/Response500'
      description: Update a set of products' records with current approval data
    post:
      summary: Release approval
      parameters:
        - description: Orchard User Id
          in: header
          name: Orchard-User-Id
          required: true
          type: string
        - in: body
          name: body
          schema:
            properties:
              product_ids:
                type: array
                items:
                  type: integer
                example:
                  - 12345
                  - 67890
      responses:
        '201':
          description: '201'
          schema:
            $ref: '#/definitions/Response201'
        '400':
          description: '400'
          schema:
            $ref: '#/definitions/Response400'
        '403':
          description: '403'
          schema:
            $ref: '#/definitions/Response403'
        '500':
          description: '500'
          schema:
            $ref: '#/definitions/Response500'
      description: Create a new record for a list of products.
  '/mena/products/{product_id}':
    get:
      summary: Get product id by review type.
      parameters:
        - description: Orchard User Id
          in: header
          name: Orchard-User-Id
          required: true
          type: string
        - in: path
          name: product_id
          description: Product id
          required: true
          type: string
      responses:
        '200':
          description: 200 ok
          schema:
            $ref: '#/definitions/GetMena200Response'
        '400':
          description: '400'
          schema:
            $ref: '#/definitions/Response400'
        '403':
          description: '403'
          schema:
            $ref: '#/definitions/Response403'
        '404':
          description: '404'
          schema:
            $ref: '#/definitions/Response404ProductId'
        '500':
          description: '500'
          schema:
            $ref: '#/definitions/Response500'
      description: Retrieve MENA approval data for a single product
    put:
      summary: Edit release page
      parameters:
        - description: Orchard User Id
          in: header
          name: Orchard-User-Id
          required: true
          type: string
        - in: path
          name: product_id
          description: Product id
          required: true
          type: string
        - in: body
          name: body
          schema:
            $ref: '#/definitions/PutMenaProduct'
      responses:
        '200':
          description: 200 ok
      description: Update a product’s record with current approval data
definitions:
  Response201:
    description: 201 error
    type: object
    properties:
      code:
        type: integer
        example: 201
      message:
        type: string
        example: Entry successfully created.
  Response400:
    description: 400 error
    type: object
    properties:
      code:
        type: integer
        example: 400
      message:
        type: string
        example: Invalid request data.
  Response403:
    description: 403 error
    type: object
    properties:
      code:
        type: integer
        example: 403
      message:
        type: string
        example: Unauthorized access.
  Response404ProductId:
    description: 404 error for product id
    type: object
    properties:
      code:
        type: integer
        example: 404
      message:
        type: string
        example: Product <product_id> not found.
  Response500:
    description: 500 error
    type: object
    properties:
      code:
        type: integer
        example: 500
      message:
        type: string
        example: Cannot connect to database server.
  CreateMenaProduct:
    description: A single mena product
    type: object
    properties:
      product_id:
        type: integer
        example: 11111
      review_timestamp:
        type: string
        format: date-time
        example: '2017-08-15 11:26:19'
      review_status:
        type: string
        example: Approved
  CreateMenaProducts:
    description: Many mena products
    type: array
    items:
      $ref: '#/definitions/CreateMenaProduct'
  GetMena200Response:
    description: Get mena document
    type: object
    properties:
      code:
        type: integer
        example: 200
      message:
        type: object
        example:
        - product_id: 100
          review_status: 'Approved'
          review_timestamp: '2017-08-15 11:26:19'
          created_timestamp: '2017-08-15 11:26:19'
        - product_id: 100
          review_status: 'Rejected'
          review_timestamp: '2017-08-14 11:26:19'
          created_timestamp: '2017-08-15 11:26:15'
        - product_id: 100
          review_status: 'Pending'
          review_timestamp: '2017-08-13 11:26:19'
          created_timestamp: '2017-08-15 11:26:19'
  PutMenaProduct:
    description: A single mena product
    type: object
    properties:
      review_timestamp:
        type: string
        format: date-time
        example: '2017-08-15 11:26:19'
      review_status:
        type: string
        example: Approved
securityDefinitions: {}
