openapi: 3.0.3
info:
  title: paint-batch-optimizer
  version: 1.1.0
  description: service for paint factory owners to minimize the cost of paint production
paths:
  /_internal_/healthcheck:
    get:
      description: GET health of service
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ComPaintbatchModelsHealthcheck'
  /v2/optimize:
    post:
      description: POST minimum cost paint batch optimizer request
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ComPaintbatchModelsOptimizeRequest'
        required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: string
        '422':
          description: Unprocessable entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ComPaintbatchModelsReadableError'
components:
  schemas:
    ComPaintbatchModelsReadableError:
      description: A simple human-readable error
      type: object
      required:
      - text
      properties:
        text:
          type: string
    ComPaintbatchModelsOptimizeRequest:
      description: paint batch optimizer request
      type: object
      required:
      - colors
      - customers
      - demands
      properties:
        colors:
          description: number of different colours demanded by paint factory
          type: integer
          format: int32
          minimum: 1
          maximum: 2000
        customers:
          description: number of customers
          type: integer
          format: int32
          minimum: 1
          maximum: 2000
        demands:
          description: customers paint demands
          type: array
          items:
            $ref: '#/components/schemas/ComPaintbatchModelsDemand'
    ComPaintbatchModelsDemand:
      description: range of customers preferences to choose from
      type: object
      required:
      - paints
      properties:
        paints:
          description: paints the customer would be satisfied with
          type: array
          maxItems: 2000
          minItems: 1
          items:
            $ref: '#/components/schemas/ComPaintbatchModelsPaint'
    ComPaintbatchModelsHealthcheck:
      description: health of the service
      type: object
      required:
      - status
      properties:
        status:
          $ref: '#/components/schemas/ComPaintbatchEnumsStatus'
          description: the health status of the service
    ComPaintbatchModelsPaint:
      description: paint and its sheen
      type: object
      required:
      - id
      - sheen
      properties:
        id:
          description: paint identifier
          type: integer
          format: int32
          minimum: 1
          maximum: 2000
        sheen:
          $ref: '#/components/schemas/ComPaintbatchEnumsSheen'
          description: sheen of the paint
    ComPaintbatchEnumsStatus:
      description: health of the service
      type: string
      enum:
      - ok
    ComPaintbatchEnumsSheen:
      description: available paint sheens
      type: string
      enum:
      - M
      - G
