info:
  title: API Specifications
  version: 0.0.1
paths:
  /goals/countries:
    get:
      parameters:
        - description: >-
            Correlation-Id to be able to find the request, that passed through
            multiple microservices in logs.
          in: header
          name: Correlation-Id
          required: false
          schema:
            type: string
      responses:
        '200':
          description: 200 OK.
        '400':
          description: Orchard-User-Id is invalid.
        '500':
          description: 500 system error.
      description: >-
        Return list of all the countries which it is possible to specify the
        goals for.
  '/goals/{productId}':
    get:
      parameters:
        - in: path
          name: productId
          required: true
          schema:
            type: string
        - description: >-
            Correlation-Id to be able to find the request, that passed through
            multiple microservices in logs.
          in: header
          name: Correlation-Id
          required: false
          schema:
            type: string
        - description: Orchard-User-Id of OA user to validate session.
          in: header
          name: Orchard-User-Id
          required: false
          schema:
            type: string
        - description: Grass account type.
          in: header
          name: Grass-Account-Type
          required: false
          schema:
            pattern: ^(vendor|subaccount)$
            type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          required: false
          schema:
            pattern: ^\d+$
            type: string
      responses:
        '200':
          description: 200 OK.
        '400':
          description: Orchard-User-Id is invalid.
        '403':
          description: 403 Forbidden.
        '404':
          description: Product with provided <productId> does not exist.
        '500':
          description: 500 system error.
      description: 'Accept product id, return sales goals data for given product.'
    patch:
      parameters:
        - in: path
          name: productId
          required: true
          schema:
            type: string
        - description: >-
            Correlation-Id to be able to find the request, that passed through
            multiple microservices in logs.
          in: header
          name: Correlation-Id
          required: false
          schema:
            type: string
        - description: Orchard-User-Id of OA user to validate session.
          in: header
          name: Orchard-User-Id
          required: false
          schema:
            type: string
        - description: Grass account type.
          in: header
          name: Grass-Account-Type
          required: false
          schema:
            pattern: ^(vendor|subaccount)$
            type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          required: false
          schema:
            pattern: ^\d+$
            type: string
        - in: header
          name: Content-Type
          required: true
          schema:
            pattern: ^application/json$
            type: string
      responses:
        '200':
          description: 200 OK.
        '400':
          description: 400 user error.
        '403':
          description: 403 Forbidden.
        '500':
          description: 500 system error.
      description: Updates sales goal data for given product.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchBody'
        required: true
    post:
      parameters:
        - in: path
          name: productId
          required: true
          schema:
            type: string
        - description: >-
            Correlation-Id to be able to find the request, that passed through
            multiple microservices in logs.
          in: header
          name: Correlation-Id
          required: false
          schema:
            type: string
        - description: Orchard-User-Id of OA user to validate session.
          in: header
          name: Orchard-User-Id
          required: false
          schema:
            type: string
        - description: Grass account type.
          in: header
          name: Grass-Account-Type
          required: false
          schema:
            pattern: ^(vendor|subaccount)$
            type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          required: false
          schema:
            pattern: ^\d+$
            type: string
        - in: header
          name: Content-Type
          required: true
          schema:
            pattern: ^application/json$
            type: string
      responses:
        '200':
          description: 200 OK.
        '400':
          description: 400 user error.
        '403':
          description: 403 Forbidden.
        '500':
          description: 500 system error.
      description: >-
        Accept product id, create sales goals entity for product, return request
        status.
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                sales_goals:
                  additionalProperties: false
                  properties:
                    first_week_estimate:
                      minimum: 0
                      nullable: true
                      type: integer
                    hmv_notes:
                      nullable: true
                      type: string
                    notes:
                      nullable: true
                      type: string
                  type: object
              required:
                - sales_goals
              type: object
        required: true
  '/goals/{productId}/{countryId}':
    delete:
      parameters:
        - in: path
          name: productId
          required: true
          schema:
            type: string
        - in: path
          name: countryId
          required: true
          schema:
            type: string
        - description: >-
            Correlation-Id to be able to find the request, that passed through
            multiple microservices in logs.
          in: header
          name: Correlation-Id
          required: false
          schema:
            type: string
        - description: Orchard-User-Id of OA user to validate session.
          in: header
          name: Orchard-User-Id
          required: false
          schema:
            type: string
        - description: Grass account type.
          in: header
          name: Grass-Account-Type
          required: false
          schema:
            pattern: ^(vendor|subaccount)$
            type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          required: false
          schema:
            pattern: ^\d+$
            type: string
      responses:
        '200':
          description: >-
            The marketing driver and target market goals for chosen product were
            successfully deleted.
        '400':
          description: 400 user error.
        '403':
          description: 403 Forbidden.
        '500':
          description: 500 system error.
      description: >-
        Delete marketing driver and target market goals for chosen product by
        product_id in specified country.
    post:
      parameters:
        - in: path
          name: productId
          required: true
          schema:
            type: string
        - in: path
          name: countryId
          required: true
          schema:
            type: string
        - description: >-
            Correlation-Id to be able to find the request, that passed through
            multiple microservices in logs.
          in: header
          name: Correlation-Id
          required: false
          schema:
            type: string
        - description: Orchard-User-Id of OA user to validate session.
          in: header
          name: Orchard-User-Id
          required: false
          schema:
            type: string
        - description: Grass account type.
          in: header
          name: Grass-Account-Type
          required: false
          schema:
            pattern: ^(vendor|subaccount)$
            type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          required: false
          schema:
            pattern: ^\d+$
            type: string
        - in: header
          name: Content-Type
          required: true
          schema:
            pattern: ^application/json$
            type: string
      responses:
        '200':
          description: 200 OK.
        '400':
          description: 400 user error.
        '403':
          description: 403 Forbidden.
        '500':
          description: 500 system error.
      description: >-
        Accept product id and country id, create target market goals entities
        for product, return request status.
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                goals:
                  items:
                    additionalProperties: false
                    properties:
                      distribution_goal_value:
                        minimum: 0
                        type: integer
                      label_goal_value:
                        minimum: 0
                        type: integer
                      store:
                        additionalProperties: false
                        properties:
                          name:
                            type: string
                          store_id:
                            minimum: 0
                            type: integer
                        required:
                          - store_id
                          - name
                        type: object
                    required:
                      - label_goal_value
                    type: object
                  type: array
                marketing_drivers:
                  additionalProperties: false
                  properties:
                    value:
                      type: string
                  required:
                    - value
                  type: object
              required:
                - goals
              type: object
        required: true
  /hello:
    get:
      responses:
        '200':
          description: 200 OK
      description: Check the health of the application.
openapi: 3.0.0
servers:
  - url: 'https://ows-sales-goals.theorchard.io/'
components:
  schemas:
    PatchBody:
      properties:
        first_week_estimate:
          minimum: 0
          nullable: true
          type: integer
        hmv_notes:
          nullable: true
          type: string
        notes:
          nullable: true
          type: string
      type: object
