openapi: 3.0.1
info:
  title: Stock Report
  version: v1
  description: Get the availability of all the products you are authorized to purchase
servers:
  - url: 'https://sandbox.api.michelin.com/stock'
    description: SANDBOX
security:
  - apiKey: []
tags:
  - name: EDIWheel C1.0
paths:
  /C1_0/report:
    get:
      tags:
        - EDIWheel C1.0
      summary: Get the list of items and their availability
      parameters:
        - name: buyerParty
          in: query
          description: >-
            Identifier of the Ship-to location for which the stock report is
            requested
          required: true
          schema:
            type: string
        - name: agencyCode
          in: query
          description: Code identifying the agency responsible for an identifier
          required: true
          schema:
            $ref: '#/components/schemas/agencyCode'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/stockReport'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not Found
components:
  schemas:
    stockReport:
      type: object
      properties:
        envelopeHeader:
          $ref: '#/components/schemas/envelopeHeader'
        totalLineItemsNumber:
          type: number
          format: int32
        buyerParty:
          $ref: '#/components/schemas/buyerParty'
        lineLevel:
          $ref: '#/components/schemas/lineLevel'
    envelopeHeader:
      type: object
      properties:
        issueDate:
          type: string
          format: date
        issueTime:
          type: string
          pattern: '\d{2}:\d{2}:\d{2}/(?:Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])$/'
          example: '06:45:17+02:00'
        documentId:
          type: string
          enum:
            - B2
        variant':
          type: string
          enum:
            - '0'
        errorCode:
          type: string
          enum:
            - '0'
    lineLevel:
      type: array
      items:
        type: object
        properties:
          lineId:
            $ref: '#/components/schemas/lineID'
          article:
            type: object
            properties:
              articleIdentification:
                $ref: '#/components/schemas/articleIdentification'
              articleDescription:
                type: object
                properties:
                  descriptionText:
                    type: string
                    example: 225/45 ZR17 94Y EXTRA LOAD TL PILOT SPORT 3 GRNX MI
              availability:
                $ref: "#/components/schemas/availability"
              availableQuantity:
                type: object
                properties:
                  quantityValue:
                    type: number
                    format: int32
                    minimum: 0
    buyerParty:
      type: object
      properties:
        partyId:
          type: string
          xml:
            name: PartyID
        agencyCode:
          $ref: '#/components/schemas/agencyCode'
      required:
        - partyId
        - agencyCode
      xml:
        name: BuyerParty
    agencyCode:
      type: string
      enum:
        - '9'
        - '91'
        - '92'
      xml:
        name: AgencyCode
      description: |
        Applicable Codes:
          * `9` - EAN (International Article Numbering association)
          * `91` - Assigned by seller or seller's agent
          * `92` - Assigned by buyer or buyer's agent
    lineID:
      type: string
      maxLength: 6
      example: '000001'
      xml:
        name: LineID
    articleIdentification:
      type: object
      properties:
        buyersArticleId:
          type: string
          xml:
            name: BuyersArticleID
        manufacturersArticleId:
          type: string
          xml:
            name: ManufacturersArticleID
        eanuccArticleId:
          type: string
          xml:
            name: EANUCCArticleID
      xml:
        name: ArticleIdentification
    availability:
      type: string
      enum:
        - '4'
        - '5'
        - '6'
      xml:
        name: Availability
      description: |
        Applicable Codes:
          * `4` - A lot of stock available.
          * `5` - Limited stock available.
          * `6` - No stock available.
  securitySchemes:
    apiKey:
      type: apiKey
      name: apikey
      in: header