swagger: '2.0'
info:
  title: Physical Product API
  version: 0.0.1
host: qa-ows-product-physical.theorchard.io
basePath: /
schemes:
  - https
paths:
  /packaging:
    get:
      parameters:
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type.
          enum:
            - vendor
            - subaccount
          in: header
          name: Grass-Account-Type
          type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
      responses:
        '200':
          examples:
            default:
              - id: 1
                name: 'Brilliant Case (Jewel Case size, Holds 2 CDs)'
              - id: 2
                name: Blister Pack
              - id: 3
                name: Blu-Ray Packaging
              - id: 4
                name: Box Set
              - id: 5
                name: Custom Packaging
              - id: 6
                name: Clam Shell
              - id: 7
                name: Cassette Case
              - id: 8
                name: Dura Case
              - id: 9
                name: Digipak
              - id: 10
                name: DVD Case
              - id: 11
                name: Fat Double (2.5cm thick jewel case)
              - id: 12
                name: Gate Fold Vinyl
              - id: 13
                name: Hard Back Book
              - id: 14
                name: Japanese Case
              - id: 15
                name: Jewel Case
              - id: 16
                name: Mini-Disc Case
              - id: 17
                name: Paper Back Book
              - id: 18
                name: Polygram Case
              - id: 19
                name: Snap Case
              - id: 20
                name: Super Jewel Case (SACD)
              - id: 21
                name: Slip Sleeve (CD or Vinyl)
              - id: 22
                name: VHS Style Case
          description: OK
      description: get a list of available physical packaging options
  /product:
    post:
      parameters:
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type
          in: header
          name: Grass-Account-Type
          pattern: ^(vendor|subaccount)$
          type: string
        - description: Grass account id
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
        - in: header
          name: Content-Type
          pattern: ^application/json$
          required: true
          type: string
        - in: body
          name: body
          required: true
          schema:
            $ref: '#/definitions/product-post'
      responses:
        '200':
          examples:
            default:
              product_id: 1234
              project_id: 3456
              product_name: Test Release 1234
              product_code: ABCD1234
              upc: 0000037423984
              label: The Hit Factory
              artist_id: 78901
              primary_artist: Test Artist
              artist_is_individual: 'N'
              version: Mexican Version
              cline: 1986 Record Label
              release_status: label_processing
              genre_id: 45
              subgenre_id: 67
              release_date: '2016-12-12'
              sale_start_date: '2016-12-12'
              distribution_format_id: 3
              packaging_id: 4
              exclusive_for: Taco Bell
              initial_stock: 4300
              box_lot: 30
              units_per_set: 2
              pricing: Priced to move
              end_date: '2016-12-12'
              discount: discoun
              explicit: 'Y'
              special_instructions: Doubles as a plate for your burritos
              wholesale_price: 9.99
              description: Pretty good
              japan_distribution: no
              edition: normal_edition
          description: >
            HTTP 200 OK

            ---------------

            It returns all the fields that were passed to it, but additionally
            the new release_id for this release. The fields are actually a combo
            of info from `release` and `product_physical`.
        '400':
          examples:
            default:
              product_code:
                message: Product code is required
                validator: required
                validator_value: true
              upc:
                message: UPC is required
                validator: required
                validator_value: true
              initial_stock:
                message: inital_stock must be of type integer
                validator: type
                validator_value: integer
          description: >
            HTTP 400 Bad Request

            --------------------

            The body contains the fields that did not pass validation with a
            validation context message.
      description: create a new product
  '/product/{productId}':
    delete:
      parameters:
        - in: path
          name: productId
          required: true
          type: string
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type.
          enum:
            - vendor
            - subaccount
          in: header
          name: Grass-Account-Type
          type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
      responses:
        '200':
          description: |
            HTTP 200 OK
            --------------------
            The physical product was successfully deleted.
        '400':
          examples:
            default:
              code: validation_error
              message:
                release_status: >-
                  'release_status' must be `label_processing` to delete a
                  product.
          description: |
            HTTP 400 Bad Request
            --------------------
            The request was not formatted correctly.
             - Could be because a product is not a physical product.
             - Could be because a product status is not `label_processing`
        '403':
          description: |
            HTTP 403 Forbidden
            --------------------
            Product ownership check fail.
        '404':
          description: |
            HTTP 404 Not Found
            --------------------
            The physical product does not exist.
      description: |
        Deletes a physical product record with given productId
    get:
      parameters:
        - in: path
          name: productId
          required: true
          type: string
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type
          in: header
          name: Grass-Account-Type
          pattern: ^(vendor|subaccount)$
          type: string
        - description: Grass account id
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
      responses:
        '200':
          examples:
            default:
              product_id: 1234
              project_id: 3456
              product_name: Test Release 1234
              product_code: ABCD1234
              upc: 0000037423984
              display_upc: 0000037423984
              manufacturer_upc: '5555537423984'
              label: The Hit Factory
              artist_id: 78901
              primary_artist: Test Artist
              artist_is_individual: 'N'
              version: Mexican Version
              cline: 1986 Record Label
              release_status: label_processing
              genre_id: 45
              subgenre_id: 67
              release_date: '2016-12-12'
              sale_start_date: '2016-12-12'
              preorder_date: '2016-12-07'
              distribution_format_id: 3
              packaging_id: 4
              exclusive_for: Taco Bell
              initial_stock: 4300
              box_lot: 30
              units_per_set: 2
              pricing: Priced to move
              start_date: '2016-12-12'
              end_date: '2016-12-12'
              discount: discoun
              explicit: 'Y'
              special_instructions: Doubles as a plate for your burritos
              wholesale_price: 9.99
              description: Pretty good
              japan_distribution: no
              edition: normal_edition
              supplychain_metadata:
                - id: 2
                  product_id: 2313007
                  store_id: 738
                  embargo_date: null
                  release_date: null
                  sale_start_date: null
                  date_added": '2018-02-02 00:00:00'
                  date_updated: '2018-02-02 00:00:00'
                - id: 3
                  product_id: 2313007
                  store_id: 739
                  embargo_date: '2018-02-02'
                  release_date: '2018-02-03'
                  sale_start_date: '2018-02-04'
                  date_added: '2018-02-02 00:00:00'
                  date_updated: '2018-02-02 00:00:00'
          description: >
            HTTP 200 OK.

            ---------------

            If the project and product ids are valid: JSON object representing
            the product.

              - This does not send back vendor or subaccount information. See the `GET /product/{productId}`
                endpoint in `ows-project-manager`.
          schema:
            $ref: '#/definitions/product-get-response'
        '403':
          description: |
            HTTP 403 Forbidden.
            --------------------
            The server understood the request, but is refusing to fulfill it.
        '404':
          description: |
            HTTP 404 Not found.
            --------------------
            Record was not found.
      description: Retrieve full data for a single product.

  '/product/{productId}/change_history':
    post:
      parameters:
        - in: path
          name: productId
          required: true
          type: string
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type.
          enum:
            - vendor
            - subaccount
          in: header
          name: Grass-Account-Type
          type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
        - enum:
            - application/json
          in: header
          name: Content-Type
          required: true
          type: string
        - in: body
          name: body
          required: true
          schema:
            $ref: '#/definitions/change-physical-product-history-post'
      responses:
        '201':
          description: |
            HTTP 201 CREATED
            ---------------
            Returns the full product.
        '400':
          description: |
            HTTP 400 Bad Request, validation failed
            --------------------
        '403':
          description: >
            HTTP 403 Forbidden.
            --------------------
            The server understood the request, but is refusing to fulfill it
            (product ownership check fail).
        '404':
          description: |
            HTTP 404 Not found.
            --------------------
            Product was not found.

    put:
      parameters:
        - in: path
          name: productId
          required: true
          type: string
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type.
          enum:
            - vendor
            - subaccount
          in: header
          name: Grass-Account-Type
          type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
        - enum:
            - application/json
          in: header
          name: Content-Type
          required: true
          type: string
        - in: body
          name: body
          required: true
          schema:
            $ref: '#/definitions/product-put'
      responses:
        '200':
          examples:
            default:
              product_id: 1234
              project_id: 3456
              product_name: Test Release 1234
              product_code: ABCD1234
              upc: 0000037423984
              label: The Hit Factory
              artist_id: 78901
              primary_artist: Test Artist
              artist_is_individual: 'N'
              version: Mexican Version
              cline: 1986 Record Label
              release_status: label_processing
              genre_id: 45
              subgenre_id: 67
              release_date: '2016-12-12'
              sale_start_date: '2016-12-12'
              distribution_format_id: 3
              packaging_id: 4
              exclusive_for: Taco Bell
              initial_stock: 4300
              box_lot: 30
              units_per_set: 2
              pricing: Priced to move
              end_date: '2016-12-12'
              discount: discoun
              explicit: 'Y'
              special_instructions: Doubles as a plate for your burritos
              wholesale_price: 9.99
              description: Pretty good
          description: |
            HTTP 200 OK
            ---------------
            Returns the full product.
        '400':
          description: |
            HTTP 400 Bad Request, validation failed
            --------------------
        '403':
          description: >
            HTTP 403 Forbidden.

            --------------------

            The server understood the request, but is refusing to fulfill it
            (product ownership check fail).
        '404':
          description: |
            HTTP 404 Not found.
            --------------------
            Product was not found.
      description: >
        Used to update an existing physical product.

        - UPC, product_code, and project_id cannot be updated.

        - This is like the POST schema, but no fields are required. UPC,
        product_code, and project_id are not accepted.

        - This only validates the HTTP request payload. Before writing to the
        persister, the posted fields to update should be applied
          to the product loaded from the database. Then the modified product object should be validated againt the POST (create) schema
          to ensure that we do not lose any required fields.
        - Any strings are set to minumum string length = 1, required or not.
        This means if the fields was sent, it should have a value.
  '/product/{productId}/copy':
    post:
      parameters:
        - in: path
          name: productId
          required: true
          type: string
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - enum:
            - application/json
          in: header
          name: Content-Type
          required: true
          type: string
        - in: body
          name: body
          required: true
          schema:
            $ref: '#/definitions/product-copy'
      responses:
        '201':
          examples:
            default:
              product_id: 123456
          description: |
            HTTP 201 CREATED
            ----------------
            Returns the product_id of the new product.
        '400':
          description: |
            HTTP 400 Bad Request
            --------------------
            The request was not formatted correctly.
        '403':
          description: >
            HTTP 403 Forbidden

            ------------------

            Direct access through grass is blocked.

            Only non-ows-grass microservice-to-microservice requests are
            allowed.
        '404':
          description: |
            HTTP 404 Not Found
            ------------------
            The product does not exist.
      description: Copy the product.
  '/product/{productId}/inventory':
    get:
      parameters:
        - in: path
          name: productId
          required: true
          type: string
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type.
          enum:
            - vendor
            - subaccount
          in: header
          name: Grass-Account-Type
          type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
      responses:
        '200':
          examples:
            default:
              on_hand: 321
              allocated: 0
              faulty: 0
              consignment: 0
              available: 456
          description: |
            HTTP 200 OK. Inventory successfully retrieved.
        '204':
          description: >
            HTTP 204 No Content.The server successfully processed the request
            and is not returning any content (all the returned values are equal
            to zero).
        '400':
          description: |
            HTTP 400 Bad Request
            --------------------
            Validation failed.
            Product ownership check failure.
        '404':
          description: |
            HTTP 404 Not found. Product was not found.
        '500':
          description: |
            HTTP 500 Internal Server Error.
      description: |
        Return inventory values for a specific product.
  '/product/{productId}/status':
    put:
      parameters:
        - in: path
          name: productId
          required: true
          type: string
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type.
          enum:
            - vendor
            - subaccount
          in: header
          name: Grass-Account-Type
          type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
        - in: body
          name: body
          required: true
          schema:
            additionalProperties: false
            properties:
              status:
                description: The status to change this product to in the approval flow.
                enum:
                  - transfer_to_content
                type: string
            required:
              - status
            type: object
      responses:
        '200':
          description: |
            HTTP 200 OK
            ---------------
            The status for the product was successfully updated.
        '400':
          description: |
            HTTP 400 Bad Request
            --------------------
            The request was not formatted correctly.
        '403':
          description: |
            HTTP 403 Forbidden
            --------------------
            Product ownership check fail.
        '404':
          description: |
            HTTP 404 Not Found
            --------------------
            The product does not exist.
      description: |
        Update the approval flow status of the product.
  '/product/{productId}/tracks':
    delete:
      parameters:
        - in: path
          name: productId
          required: true
          type: string
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type.
          enum:
            - vendor
            - subaccount
          in: header
          name: Grass-Account-Type
          type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
      responses:
        '200':
          description: |
            HTTP 200 OK.
            ---------------------
            Tracks successfully deleted.
        '400':
          examples:
            default:
              code: validation_error
              message:
                Grass-Account-Type:
                  validator: required
                  message: '''Grass-Account-Type'' is a required property'
                  validator_value: true
          description: |
            HTTP 400 Bad Request.
            ---------------------
            The request was not formatted correctly. (Header validation failure)
        '403':
          description: >
            HTTP 403 Forbidden.

            ---------------------

            The server understood the request, but is refusing to fulfill it
            (product ownership check failure).
        '404':
          description: |
            HTTP 404 Not Found.
            ---------------------
            Product was not found.
      description: |
        Delete all tracks for an existing product.
    get:
      parameters:
        - in: path
          name: productId
          required: true
          type: string
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type.
          enum:
            - vendor
            - subaccount
          in: header
          name: Grass-Account-Type
          type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
      responses:
        '200':
          examples:
            default:
              items:
                - track_id: 1234
                  track_number: 1
                  track_name: Hightail it to Chalupa-ville
                  performer:
                    - Dave Matthews Bando
                    - Yeezus
                  isrc: '123456789012'
                  disc: 1
                  length:
                    formatted: '00:07:23'
                    hours: 0
                    minutes: 7
                    seconds: 23
                - track_id: 1235
                  track_number: 2
                  track_name: I Met a Gordita in Tijuana
                  performer:
                    - Johnny Cash
                  isrc: '123456789013'
                  disc: 1
                  length:
                    formatted: '00:05:12'
                    hours: 0
                    minutes: 5
                    seconds: 12
                - track_id: 1236
                  track_number: 1
                  track_name: Yo Soy Loco Con Los Doritos Locos Tacos
                  performer:
                    - Vanilla Ice
                  isrc: null
                  disc: null
                  length: null
              pagination:
                type: standard
                offset: 0
                limit: 3
                total_records: 3
          description: |
            HTTP 200 OK. Tracks successfully retrieved.
        '400':
          description: |
            HTTP 400 Bad Request. Validation failed.
        '403':
          description: >
            HTTP 403 Forbidden. The server understood the request, but is
            refusing to fulfill it (product ownership check fail).
        '404':
          description: |
            HTTP 404 Not found. Product was not found.
      description: |
        Get tracks for an existing product.
    put:
      parameters:
        - in: path
          name: productId
          required: true
          type: string
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type.
          enum:
            - vendor
            - subaccount
          in: header
          name: Grass-Account-Type
          type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
        - in: body
          name: body
          required: true
          schema:
            $ref: '#/definitions/product-tracks-put'
      responses:
        '200':
          examples:
            default:
              items:
                - track_id: 1234
                  track_number: 1
                  track_name: Hightail it to Chalupa-ville
                  performer:
                    - Dave Matthews Bando
                    - Yeezus
                  isrc: '123456789012'
                  disc: 1
                  length:
                    formatted: '00:07:23'
                    hours: 0
                    minutes: 7
                    seconds: 23
                - track_id: 1235
                  track_number: 2
                  track_name: I Met a Gordita in Tijuana
                  performer:
                    - Johnny Cash
                  isrc: '123456789013'
                  disc: 1
                  length:
                    formatted: '00:05:12'
                    hours: 0
                    minutes: 5
                    seconds: 12
                - track_id: 1236
                  track_number: 1
                  track_name: Yo Soy Loco Con Los Doritos Locos Tacos
                  performer:
                    - Vanilla Ice
                  isrc: null
                  disc: null
                  length: null
              pagination:
                type: standard
                offset: 0
                limit: 3
                total_records: 3
          description: >
            HTTP 200 Ok. Tracks successfully created/updated/deleted. On
            creation, the track object will contain an auto-incremented
            `track_id` property.
        '400':
          examples:
            default:
              code: validation_error
              message:
                global:
                  message: There are errors with your track numbers.
                  validator_value: true
                  validator: sequence_integrity
                tracks:
                  - track_name:
                      message: '''track_name'' is a required property'
                      validator_value: true
                      validator: required
                  - performer:
                      message: '''performer'' is a required property'
                      validator_value: true
                      validator: required
                  - null
                  - performer:
                      message: '''performer'' is a required property'
                      validator_value: true
                      validator: required
                    track_name:
                      message: '''track_name'' is a required property'
                      validator_value: true
                      validator: required
                  - null
                  - null
          description: >
            HTTP 400 Bad Request. Validation failed.


            ## Basic Response Format

            There will always be an indicator of track level or global errors.


            ```js
              {
                "tracks": [], // ... array of items containing track level errors or null if no errors
                "global": {} // a single object indicating the validator and validator value triggering the global error
              }
            ```

            ## Global Validation Errors


            - _isrc_unique_: ISRC must be unique for each track on a disc

            - _tracks_unique_: There are duplicate tracks in your tracklist.

            - _sequence_integrity_: For each disc, there can be no missing
            sequence numbers and the sequence should start with 1ach disc, there
            can be no missing sequence numbers and the sequence should start
            with 1.
        '403':
          description: >
            HTTP 403 Forbidden. The server understood the request, but is
            refusing to fulfill it (product ownership check fail).
        '404':
          description: |
            HTTP 404 Not found. Product was not found.
      description: |
        Add/Update/Delete tracks for an existing product.
  '/product/{productId}/tracks/copy/{newProductId}':
    post:
      parameters:
        - in: path
          name: productId
          required: true
          type: string
        - in: path
          name: newProductId
          required: true
          type: string
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type.
          enum:
            - vendor
            - subaccount
          in: header
          name: Grass-Account-Type
          type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
      responses:
        '200':
          description: |
            HTTP 200 OK
            -----------
            Product tracks copied.
        '400':
          description: |
            HTTP 400 Bad Request
            --------------------
            Validation failed.
            Product ownership check fail.
        '404':
          description: |
            HTTP 404 Not found
            ------------------
            Product was not found.
      description: Copy product tracks to new product
  '/product/{productId}/tracks/publishing-obligation':
    get:
      parameters:
        - in: path
          name: productId
          required: true
          type: string
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type.
          enum:
            - vendor
            - subaccount
          in: header
          name: Grass-Account-Type
          type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
      responses:
        '200':
          examples:
            default:
              items:
                - tuid: 1
                  us_publishing_obligation: Composition
                  third_party_publisher: 'Y'
                  publisher_names:
                    - Pub 1
                    - Pub 2
                - tuid: 2
                  us_publishing_obligation: ControlledByYourLabel
                  third_party_publisher: 'N'
                  publisher_names: []
                - tuid: 3
                  us_publishing_obligation: null
                  third_party_publisher: null
                  publisher_names: []
              pagination:
                type: none
                total_records: 3
          description: |
            HTTP 200 OK. Publishing obligation successfully retrieved.
        '400':
          description: |
            HTTP 400 Bad Request. Validation failed.
        '403':
          description: |
            HTTP 403 Forbidden. Product ownership check failed.
        '404':
          description: |
            HTTP 404 Not found. Product was not found.
        '500':
          description: |
            HTTP 500 Server error.
      description: |
        Get publishing obligation for all tracks that belong to product.
  '/product/{productId}/supply-chain-defaults':
    get:
      parameters:
        - in: path
          name: productId
          required: true
          type: integer
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type.
          enum:
            - vendor
            - subaccount
          in: header
          name: Grass-Account-Type
          type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
      responses:
        '200':
          examples:
            default:
              - product_physical_supply_chain_id: 1
                returnability: N
                store_id: 738
                product_id: 1
                return_disposition: Keep
              - product_physical_supply_chain_id: 2
                returnability: N
                store_id: 739
                product_id: 1
                return_disposition: Keep
          description: |
            HTTP 200 OK. Supply chain info for product successfully retrieved.
        '403':
          description: |
            HTTP 403 Bad Request
            --------------------
            Validation failed.
            Product ownership check failure.
        '404':
          description: |
            HTTP 404 Not found. Product was not found.
        '500':
          description: |
            HTTP 500 Internal Server Error.
      description: |
        Returns supply chain info for a specific product.
  /product/{productId}/supply_chain_defaults:
    post:
      parameters:
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type
          in: header
          name: Grass-Account-Type
          type: string
          enum:
            - vendor
            - subaccount
        - description: Grass account id
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
        - in: header
          name: Content-Type
          type: string
          required: false
        - description: Primary id for Physical Product for which the default values are to be set at store level.
          in: path
          name: productId
          required: true
          type: integer
      responses:
        '200':
          examples:
            738:
              returnability: 1
              return_disposition: Keep
            739:
              returnability: 1
              return_disposition: Keep
          description: >
            HTTP 200 OK
        '404':
          examples:
            code: not_found_error
            message: Product Id not found
          description: >
            HTTP 404 NOT FOUND ERROR
        '500':
          examples:
            code: server_error
            message: Could not connect to Mysql Database
          description: >
            HTTP 500 SERVER ERROR
      description: Accept product_id and set the supply chain default values for the Physical Product.
  '/product/{productId}/supply_chain_metadata':
    get:
      parameters:
        - in: path
          name: productId
          required: true
          type: string
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type.
          enum:
            - vendor
            - subaccount
          in: header
          name: Grass-Account-Type
          type: string
        - description: Grass account id.
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
      responses:
        '200':
          examples:
            default:
              - id: 2
                product_id: 2313007
                store_id: 738
                embargo_date: null
                release_date: null
                sale_start_date: null
                date_added: "2018-02-02 00:00:00"
                date_updated: "2018-02-02 00:00:00"
              - id: 3
                product_id: 2313007
                store_id: 739
                embargo_date: "2018-02-02"
                release_date: "2018-02-03"
                sale_start_date: "2018-02-04"
                date_added: "2018-02-02 00:00:00"
                date_updated: "2018-02-02 00:00:00"

          description: |
            HTTP 200 OK. supply chain metadata successfully retrieved.
        '204':
          description: >
            HTTP 204 No Content.The server successfully processed the request
            and is not returning any content (all the returned values are equal
            to zero).
        '400':
          description: |
            HTTP 400 Bad Request
            --------------------
            Validation failed.
            Product ownership check failure.
        '404':
          description: |
            HTTP 404 Not found. Product was not found.
        '500':
          description: |
            HTTP 500 Internal Server Error.
      description: |
        Return supply chain metadata for a specific product.
  /product/{productId}/supply-chain-metadata:
    post:
      parameters:
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type
          in: header
          name: Grass-Account-Type
          pattern: ^(vendor|subaccount)$
          type: string
        - description: Grass account id
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: integer
        - in: header
          name: Content-Type
          pattern: ^application/json$
          required: true
          type: string
        - in: path
          name: productId
          type: integer
          required: true
          description: Unique Id of product.
        - in: body
          name: body
          required: true
          schema:
            $ref: '#/definitions/supply-chain-metadata-post'
      responses:
        '200':
          examples:
            default:
              - id: 2
                product_id: 2313007
                store_id: 738
                embargo_date: null
                release_date: null
                sale_start_date: null
                date_added: "2018-02-02 00:00:00"
              - id: 3
                product_id: 2313007
                store_id: 739
                embargo_date: "2018-02-02"
                release_date: "2018-02-03"
                sale_start_date: "2018-02-04"
                date_updated: "2018-02-02 00:00:00"
          description: >
            HTTP 200 OK

            ---------------

            It returns all the fields that were passed to it, but additionally
            the new supply chain metadata id for this product and store id combination
            and date_added field.
            It returns date_updated field if record already existed.
        '204':
          description: >
            HTTP 204 No Content.The server successfully processed the request
            and is not returning any content (all the returned values are equal
            to zero).
        '400':
          description: |
            HTTP 400 Bad Request
            --------------------
            Validation failed.
            Product ownership check failure.
        '404':
          description: |
            HTTP 404 Not found. Product was not found.
        '500':
          description: |
            HTTP 500 Internal Server Error.
      description: |
        Returns inserted or updated record of supply chain metadata.
  '/product-distribution/{productId}':
    get:
      parameters:
        - in: path
          name: productId
          required: true
          type: string
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
        - description: Grass account type
          in: header
          name: Grass-Account-Type
          pattern: ^(vendor|subaccount)$
          type: string
        - description: Grass account id
          in: header
          name: Grass-Account-Id
          pattern: ^\d+$
          type: string
      responses:
        '200':
          examples:
            default:
              id: 1
              product_id: 1234
              distribute_to: 'JP'
          description: >
            HTTP 200 OK.

            ---------------

            If the product id is valid: JSON object representing
            the details of physical product to which country it will distribute.


        '403':
          description: |
            HTTP 403 Forbidden.
            --------------------
            The server understood the request, but is refusing to fulfill it.
        '404':
          description: |
            HTTP 404 Not found.
            --------------------
            Record was not found.
      description: Retrieve distribution data for a single product.

definitions:
  change-physical-product-history-post:
    additionalProperties: false
    properties:
      field_name:
        type: string
        enum:
          - artwork
          - wholesale_price
        description: Name of field that changed.
      upc:
        type: number
        minimum: 1
        description: The value that we use to derive an artworkpath.
      store_id:
        type: integer
        description: 'Store ID mapping to customer_master_master.id'
      new_price:
        type: number
        maximum: 9999.99
        minimum: 0
        description: 'New suggested retail price (e.g.: 9.99).'
    required:
      - field_name
    type: object
  product-tracks-put:
    properties:
      items:
        additionalProperties: false
        items:
          additionalProperties: false
          properties:
            disc:
              description: Maps to track.cd.
              type: integer
            is_deleted:
              description: >-
                If set to 'Y', this track will be removed from the product.
                track_id must be set for this to execute.
              enum:
                - 'Y'
                - 'null'
              type: string
            isrc:
              description: Maps to track.isrc.
              maxLength: 12
              minLength: 12
              type: string
            length:
              description: >-
                String representation of time in HH:MM:SS or H:M:SS format. Maps
                to track.length_minutes and track.length_seconds.
              minLength: 1
              pattern: '[0-9]{1,3}:[0-5]?[0-9]:[0-5][0-9]'
              type: string
            performer:
              description: >-
                Maps one-to-many from track to to track_artist. Each item should
                map to track_artist.artist_name, and track_artist.type should be
                set to 'performer'. Required to create.
              minLength: 1
              type: array
              items:
                type: string
            third_party_publisher:
              enum:
                - 'Y'
                - 'N'
              maxLength: 1
              minLength: 1
              type: string
            track_id:
              description: Maps to track.id.
              type: integer
            track_name:
              description: Maps to track.name. Required to create.
              maxLength: 100
              minLength: 1
              type: string
            track_number:
              description: >-
                Maps to track.track_id. The sequence of this track on the disc.
                Required to create.
              maximum: 65535
              minimum: 0
              type: integer
            us_publishing_obligation:
              enum:
                - Composition
                - ControlledByYourLabel
                - PublicDomain
              maxLength: 50
              minLength: 1
              type: string
          type: object
        type: array
    type: object
  product-copy:
    additionalProperties: false
    properties:
      display_configuration:
        description: >-
          Display configuration of a physical product e.g.: 2 x CD + Viking
          Ship.
        maxLength: 128
        minLength: 1
        type: string
      distribution_format_id:
        description: PK for `distribution_format` table
        type: integer
      product_code:
        description: This is mapped to releases.product_code internally
        maxLength: 14
        minLength: 1
        type: string
      units_per_set:
        description: >-
          The number of units in one product, i.e. a dual-disc vinyl would be 2
          "units per set".
        type: integer
    required:
      - product_code
      - distribution_format_id
      - units_per_set
    type: object
  product-get-response:
    additionalProperties: false
    properties:
      artist_id:
        description: The id of the product.
        minimum: 1
        type: integer
      artist_is_individual:
        description: Is the primary artist an individual or a band/group.
        enum:
          - 'Y'
          - 'N'
        type: string
      box_lot:
        description: >-
          Quantity field in `product_physical` representing number of this
          product in one box.
        type: integer
      cline:
        description: 'The copyright line e.g.: 1986 Record Label.'
        minLength: 1
        pattern: '^[0-9]{4}(\s\w+)+'
        type: string
      description:
        description: Short summary of the release.
        maxLength: 1400
        minLength: 1
        type: string
      discount:
        description: >-
          String field in `product_physical` describing a percentage and details
          of a discount between 0 and 100
        maxLength: 250
        minLength: 1
        type: string
      display_configuration:
        description: >-
          Display configuration of a physical product e.g.: 2 x CD + Viking
          Ship.
        maxLength: 128
        minLength: 1
        type: string
      display_upc:
        description: Display UPC associated with this product.
        format: upc
        maxLength: 13
        minLength: 12
        pattern: ^\d*$
        type: string
      distribution_format_id:
        description: PK for `distribution_format` table
        type: integer
      end_date:
        description: String representation of date. YYYY-MM-DD this is a discount end date
        type: string
      exclusive_for:
        description: >-
          Varchar field in `product_physical`, describing any exclusivity
          information for this product.
        maxLength: 128
        minLength: 1
        type: string
      explicit:
        description: Sets if a product is explicit.
        enum:
          - 'Y'
          - 'N'
        type: string
      genre_id:
        description: Maps to `genre_id` from the `genre` table.
        type: integer
      initial_stock:
        description: >-
          Quantity field in `product_physical` representing initial quantity of
          this product.
        type: integer
      label:
        description: The imprint / label
        maxLength: 70
        minLength: 1
        type: string
      manufacturer_upc:
        type: string
      manufacturing_obligation:
        description: Indicates if the product is has a manufacturing obligation.
        enum:
          - 'Y'
          - 'N'
        type: string
      packaging_id:
        description: >-
          PK for `product_physical_packaging`, stored in `product_physical`,
          describing the type of packing this product will be distributed in.
        type: integer
      pline:
        description: >-
          Stands for 'Publishing line' and is a metadata field associated with
          all products.
        minLength: 1
        pattern: '^[0-9]{4}(\s\w+)+'
        type: string
      pricing:
        description: 'Suggested retail price (e.g.: 9.99).'
        maximum: 9999.99
        minimum: 0
        type: number
      primary_artist:
        description: 'This is mapped to release_artist.artist_name, entered as input text'
        minLength: 1
        type: string
      product_code:
        description: This is mapped to releases.product_code internally
        maxLength: 128
        minLength: 1
        type: string
      product_highlights:
        description: >-
          Any product highlights and sales notes, including relevant information
          for sales reps. Things like: co-op spend, extra content, extra content
          description, similar artists, etc.
        minLength: 1
        type: string
      product_id:
        description: The id of the product.
        minimum: 1
        type: integer
      product_name:
        description: This is mapped to releases.release_name internally.
        maxLength: 255
        minLength: 1
        type: string
      product_type:
        description: 'This is `new_release` in the `release` table. E.g.: ''New'', ''Catalog'''
        pattern: ^(New|Catalog)$
        type: string
      production_notes:
        description: Production notes for the product.
        minLength: 1
        type: string
      project_id:
        description: PK from the `project` table used to group this product.
        minimum: 1
        type: integer
      release_date:
        description: String representation of date. YYYY-MM-DD
        pattern: '^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])$'
        type: string
      release_status:
        description: Release status of the product.
        enum:
          - label_processing
          - transfer_to_content
          - in_content
        type: string
      sale_start_date:
        description: String representation of date. YYYY-MM-DD
        pattern: '^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])$'
        type: string
      special_instructions:
        description: >-
          Open text field which contains operational information for Digital and
          Physical products.
        maxLength: 250
        minLength: 1
        type: string
      subaccount_id:
        description: The id of the product.
        minimum: 1
        type: integer
      subgenre_id:
        description: Maps to `orchard_id` from the `subgenre` table.
        type: integer
      units_per_set:
        description: >-
          The number of units in one product, i.e. a dual-disc vinyl would be 2
          "units per set".
        type: integer
      upc:
        description: UPC associated with this product.
        format: upc
        maxLength: 13
        minLength: 12
        pattern: ^\d*$
        type: string
      version:
        description: Optional version name for this release.
        maxLength: 255
        minLength: 1
        type: string
      wholesale_price:
        description: 'Wholesale price (e.g.: 5.99).'
        maximum: 9999.99
        minimum: 0
        type: number
      japan_distribution:
        description: 'Whether this product will be distributed to Japan only, to Japan and some other territories or not distributed to Japan'
        enum:
          - 'no'
          - 'yes_only'
          - 'yes_other'
        type: string
      edition:
        description: 'The packaging edition for this product.'
        enum:
          - 'normal_edition'
          - 'first_run_limited_edition'
          - 'initial_limited_edition'
          - 'limited_edition'
          - 'period_limited_edition'
        type: string
    required:
      - artist_id
      - artist_is_individual
      - cline
      - pline
      - product_id
      - project_id
      - product_name
      - product_code
      - upc
      - display_upc
      - manufacturer_upc
      - label
      - primary_artist
      - version
      - genre_id
      - subgenre_id
      - release_status
      - release_date
      - sale_start_date
      - product_type
      - distribution_format_id
      - packaging_id
      - exclusive_for
      - initial_stock
      - box_lot
      - units_per_set
      - pricing
      - end_date
      - discount
      - special_instructions
      - wholesale_price
      - explicit
      - description
      - product_highlights
      - production_notes
      - subaccount_id
    type: object
  product-post:
    additionalProperties: false
    properties:
      artist_is_individual:
        description: Is the primary artist an individual or a band/group.
        enum:
          - 'Y'
          - 'N'
        type: string
      assign_display_upc:
        description: Used to set display_upc to an orchard assigned value.
        type: boolean
      box_lot:
        description: >-
          Quantity field in `product_physical` representing number of this
          product in one box.
        type: integer
      cline:
        description: 'The copyright line e.g.: 1986 Record Label.'
        pattern: '^[0-9]{4}(\s\w+)+'
        type: string
      description:
        description: Short summary of the release.
        maxLength: 1400
        minLength: 1
        type: string
      discount:
        description: >-
          String field in `product_physical` describing a percentage and details
          of a discount between 0 and 100
        maxLength: 250
        minLength: 1
        type: string
      display_configuration:
        description: >-
          Display configuration of a physical product e.g.: 2 x CD + Viking
          Ship.
        maxLength: 128
        minLength: 1
        type: string
      distribution_format_id:
        description: PK for `distribution_format` table
        type: integer
      end_date:
        description: String representation of date. YYYY-MM-DD this is a discount end date
        type: string
      exclusive_for:
        description: >-
          Varchar field in `product_physical`, describing any exclusivity
          information for this product.
        maxLength: 128
        type: string
      explicit:
        description: Sets if a product is explicit.
        enum:
          - 'Y'
          - 'N'
        type: string
      genre_id:
        description: Maps to `genre_id` from the `genre` table.
        type: integer
      initial_stock:
        description: >-
          Quantity field in `product_physical` representing initial quantity of
          this product.
        type: integer
      label:
        description: The imprint / label
        maxLength: 70
        type: string
      packaging_id:
        description: >-
          PK for `product_physical_packaging`, stored in `product_physical`,
          describing the type of packing this product will be distributed in.
        type: integer
      pline:
        description: >-
          Stands for 'Publishing line' and is a metadata field associated with
          all products.
        minLength: 1
        pattern: '^[0-9]{4}(\s\w+)+'
        type: string
      pricing:
        description: 'Suggested retail price (e.g.: 9.99).'
        maximum: 9999.99
        minimum: 0
        type: number
      primary_artist:
        description: 'This is mapped to release_artist.artist_name, entered as input text'
        type: string
      product_code:
        description: This is mapped to releases.product_code internally
        maxLength: 14
        minLength: 1
        type: string
      product_highlights:
        description: >-
          Any product highlights and sales notes, including relevant information
          for sales reps. Things like: co-op spend, extra content, extra content
          description, similar artists, etc.
        minLength: 1
        type: string
      product_name:
        description: This is mapped to releases.release_name internally.
        maxLength: 255
        type: string
      product_type:
        description: 'This is `new_release` in the `release` table. E.g.: ''New'', ''Catalog'''
        pattern: ^(New|Catalog)$
        type: string
      project_id:
        description: PK from the `project` table used to group this product.
        minimum: 1
        type: integer
      release_date:
        description: String representation of date. YYYY-MM-DD
        pattern: '^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])$'
        type: string
      sale_start_date:
        description: String representation of date. YYYY-MM-DD
        pattern: '^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])$'
        type: string
      special_instructions:
        description: >-
          Open text field which contains operational information for Digital and
          Physical products.
        maxLength: 250
        minLength: 1
        type: string
      subgenre_id:
        description: Maps to `orchard_id` from the `subgenre` table.
        type: integer
      units_per_set:
        description: >-
          The number of units in one product, i.e. a dual-disc vinyl would be 2
          "units per set".
        type: integer
      upc:
        description: UPC associated with this product.
        format: upc
        maxLength: 13
        minLength: 12
        pattern: ^\d*$
        type: string
      version:
        description: Optional version name for this release.
        maxLength: 255
        type: string
      wholesale_price:
        description: 'Wholesale price (e.g.: 5.99).'
        maximum: 9999.99
        minimum: 0
        type: number
      japan_distribution:
        description: 'Whether this product will be distributed to Japan only, to Japan and some other territories or not distributed to Japan'
        enum:
          - 'no'
          - 'yes_only'
          - 'yes_other'
        type: string
      edition:
        description: 'The packaging edition for this product.'
        enum:
          - 'normal_edition'
          - 'first_run_limited_edition'
          - 'initial_limited_edition'
          - 'limited_edition'
          - 'period_limited_edition'
        type: string
    required:
      - artist_is_individual
      - cline
      - pline
      - project_id
      - product_name
      - product_code
      - label
      - primary_artist
      - genre_id
      - subgenre_id
      - release_date
      - sale_start_date
      - product_type
      - distribution_format_id
      - packaging_id
      - units_per_set
      - wholesale_price
      - explicit
    type: object
  product-put:
    additionalProperties: false
    properties:
      artist_is_individual:
        description: Is the primary artist an individual or a band/group.
        enum:
          - 'Y'
          - 'N'
        minLength: 1
        type: string
      assign_display_upc:
        description: Used to set display_upc to an orchard assigned value.
        type: boolean
      box_lot:
        description: >-
          Quantity field in `product_physical` representing number of this
          product in one box.
        type: integer
      cline:
        description: 'The copyright line e.g.: 1986 Record Label.'
        minLength: 1
        pattern: '^[0-9]{4}(\s\w+)+'
        type: string
      description:
        description: Short summary of the release.
        maxLength: 1400
        minLength: 1
        type: string
      discount:
        description: >-
          String field in `product_physical` describing a percentage and details
          of a discount between 0 and 100
        maxLength: 250
        minLength: 1
        type: string
      display_configuration:
        description: >-
          Display configuration of a physical product e.g.: 2 x CD + Viking
          Ship.
        maxLength: 128
        minLength: 1
        type: string
      display_upc:
        description: UPC associated with this product.
        format: upc
        maxLength: 13
        minLength: 12
        pattern: ^\d*$
        type: string
      distribution_format_id:
        description: PK for `distribution_format` table
        type: integer
      end_date:
        description: String representation of date. YYYY-MM-DD this is a discount end date
        minLength: 1
        type: string
      exclusive_for:
        description: >-
          Varchar field in `product_physical`, describing any exclusivity
          information for this product.
        maxLength: 128
        minLength: 1
        type: string
      explicit:
        description: Sets if a product is explicit.
        enum:
          - 'Y'
          - 'N'
        minLength: 1
        type: string
      genre_id:
        description: Maps to `genre_id` from the `genre` table.
        type: integer
      initial_stock:
        description: >-
          Quantity field in `product_physical` representing initial quantity of
          this product.
        type: integer
      label:
        description: The imprint / label
        maxLength: 70
        minLength: 1
        type: string
      packaging_id:
        description: >-
          PK for `product_physical_packaging`, stored in `product_physical`,
          describing the type of packing this product will be distributed in.
        type: integer
      pline:
        description: >-
          Stands for 'Publishing line' and is a metadata field associated with
          all products.
        minLength: 1
        pattern: '^[0-9]{4}(\s\w+)+'
        type: string
      pricing:
        description: 'Suggested retail price (e.g.: 9.99).'
        maximum: 9999.99
        minimum: 0
        type: number
      primary_artist:
        description: 'This is mapped to release_artist.artist_name, entered as input text'
        minLength: 1
        type: string
      product_code:
        description: This is mapped to releases.product_code internally
        maxLength: 14
        minLength: 1
        type: string
      product_highlights:
        description: >-
          Any product highlights and sales notes, including relevant information
          for sales reps. Things like: co-op spend, extra content, extra content
          description, similar artists, etc.
        minLength: 1
        type: string
      product_name:
        description: This is mapped to releases.release_name internally.
        maxLength: 255
        minLength: 1
        type: string
      product_type:
        description: 'This is `new_release` in the `release` table. E.g.: ''New'', ''Catalog'''
        minLength: 1
        pattern: ^(New|Catalog)$
        type: string
      release_date:
        description: String representation of date. YYYY-MM-DD
        minLength: 1
        pattern: '^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])$'
        type: string
      sale_start_date:
        description: String representation of date. YYYY-MM-DD
        minLength: 1
        pattern: '^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])$'
        type: string
      special_instructions:
        description: >-
          Open text field which contains operational information for Digital and
          Physical products.
        maxLength: 250
        minLength: 1
        type: string
      subgenre_id:
        description: Maps to `orchard_id` from the `subgenre` table.
        type: integer
      units_per_set:
        description: >-
          The number of units in one product, i.e. a dual-disc vinyl would be 2
          "units per set".
        type: integer
      version:
        description: Optional version name for this release.
        maxLength: 255
        minLength: 1
        type: string
      wholesale_price:
        description: 'Wholesale price (e.g.: 5.99).'
        maximum: 9999.99
        minimum: 0
        type: number
      japan_distribution:
        description: 'Whether this product will be distributed to Japan only, to Japan and some other territories or not distributed to Japan'
        enum:
          - 'no'
          - 'yes_only'
          - 'yes_other'
        type: string
      edition:
        description: 'The packaging edition for this product.'
        enum:
          - 'normal_edition'
          - 'first_run_limited_edition'
          - 'initial_limited_edition'
          - 'limited_edition'
          - 'period_limited_edition'
        type: string
    type: object
  supply-chain-metadata-post:
    additionalProperties: false
    properties:
      release_date:
        description: Release date of product specific to supply chain.
        type: string
      embargo_date:
        description: Embargo date of product specific to supply chain.
        type: string
      sale_start_date:
        description: Sale start date of product specific to supply chain.
        type: string
      store_id:
        description: Id of supply chain.
        type: integer
    type: object
securityDefinitions: {}
