swagger: '2.0'
info:
  title: OWS Sales Goals API Spec
  version: 0.0.1
schemes: [https]
host: qa-ows-sales-goals.theorchard.io
tags:
- name: health
  description: Healthcheck
- name: digital
  description: Digital related endpoints
- name: marketing_highlights
  description: Marketing Highlights related endpoints
paths:
  /hello:
    get:
      tags:
      - health
      description: Check the health of the application.
      responses:
        200:
          description: 200 OK
          examples:
            application/json:
              status: ok
  /marketing_highlights/{project_id}:
    post:
      tags:
      - marketing_highlights
      parameters:
        - in: path
          name: project_id
          description: project id for the marketing highlight.          
          required: true
          type: integer
        - description: Grass account type.
          in: header
          name: Grass-Account-Type
          required: false
          type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          required: false
          type: string
        - name: body
          in: body
          description: JSON payload of marketing highlight to post.
          required: true
          schema:
            $ref: "#/definitions/PostMarketingHighlightsPayload"
      responses:
        200:
          description: 200 OK.
          examples:
            application/json:
              {
                'ok': true
              }       
        400:
          description: 400 validation error.
        403:
          description: 403 forbidden.
        404:
          description: 404 product not found.
        500:
          description: 500 system error
  /digital/{product_id}:
    post:
      tags:
      - digital
      parameters:
        - in: path
          name: product_id
          description: Product id.
          required: true
          type: integer
        - description: Orchard-User-Id of OA user to validate session.
          in: header
          name: Orchard-User-Id
          required: false
          type: string
        - name: body
          in: body
          description: JSON payload of digital product to post.
          required: true
          schema:
            $ref: "#/definitions/PostDigitalPayload"
      responses:
        200:
          description: 200 OK.
          examples:
            application/json:
              {
                "apple_total": "1",
                "downloads_total": "1",
                "spotify_total": "1",
                "other_total": "1",
                "internal_note": "sss"
              }       
        400:
          description: 400 validation error.
        403:
          description: 403 forbidden.
        404:
          description: 404 product not found.
        500:
          description: 500 system error
  /digital/{product_id}/projections:
    post:
      tags:
      - digital
      parameters:
        - in: path
          name: product_id
          description: Product id projections.
          required: true
          type: integer
        - description: Orchard-User-Id of OA user to validate session.
          in: header
          name: Orchard-User-Id
          required: false
          type: string
        - name: body
          in: body
          description: JSON payload of digital product projections to post.
          required: true
          schema:
            $ref: "#/definitions/PostDigitalProjectionsPayload"
      responses:
        200:
          description: 200 OK.
          examples:
            application/json:
              {
                "items": [
                  {
                      "apple_projection": 11,
                      "downloads_projection": 11,
                      "spotify_projection": 11,
                      "other_projection": 11,
                      "territory_id": 1,
                      "id": 269620
                  }
                ]
            }      
        400:
          description: 400 validation error.
        403:
          description: 403 forbidden.
        404:
          description: 404 product not found.
        500:
          description: 500 system error.
definitions:
  PostMarketingHighlightsPayload:
    type: array
    items:
      type: object
      properties:
        marketing_highlight:
          type: string
        sync_highlight:
          type: string
        country_id:
          type: integer
        store:
          type: string
    example:  [
                {
                  "marketing_highlight": "marketing highlight description",
                  "sync_highlight": "sync highlight description",
                  "country_id": null,
                  "store": null
                },
                {
                  "marketing_highlight": "SS",
                  "sync_highlight": "AA",
                  "country_id": 1,
                  "store": null
                },
                {
                  "marketing_highlight": "CC",
                  "sync_highlight": "AA",
                  "country_id": 2,
                  "store": null
                }
              ]
  PostDigitalPayload:
    type: object
    properties:
      apple_total:
        type: string
      downloads_total:
        type: string
      spotify_total:
        type: string
      other_total:
        type: string
      internal_note:
        type: string
    example:  {
                "apple_total": "1",
                "downloads_total": "1",
                "spotify_total": "1",
                "other_total": "1",
                "internal_note": "sss"
              }
  PostDigitalProjectionsPayload:
    type: object
    properties:
      items:
        type: array
        items:
          type: object
          properties:
            apple_total:
              type: string
            downloads_total:
              type: string
            spotify_total:
              type: string
            other_total:
              type: string
            internal_note:
              type: string
    example:  {
                "items": [
                  {
                    "apple_projection": 11,
                    "downloads_projection": 11,
                    "spotify_projection": 11,
                    "other_projection": 11,
                    "territory_id": 1
                  }
                ]
              }
