/item/{storeid}:
  get:
    tags:
    - item
    description: Return all the items belong to given store
    operationId: listItems
    security:
    - bearerAuth: []
    parameters:
    - $ref#storeid: './parameters/storeid.yaml'
    responses:
      $ref#4xx: './responses/4xx.yaml'
      200:
        description: list of item
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/Item'
  post:
    tags:
    - item
    description: Update/Create item
    operationId: saveItem
    security:
    - bearerAuth: []
    parameters:
    - $ref#storeid: './parameters/storeid.yaml'
    requestBody:
      required: true
      content:
        application/json: 
          schema: 
            $ref: '#/components/schemas/Item'
    responses:
      $ref#4xx: './responses/4xx.yaml'
      $ref#upsert: './responses/20x-upsert.yaml'

/item/{storeid}/{id}:
  get:
    tags:
    - item
    description: Return the item with given id
    operationId: loadItem
    security:
    - bearerAuth: []
    parameters:
    - $ref#storeid: './parameters/storeid.yaml'
    - $ref#id: './parameters/objectid.yaml'
    responses:
      $ref#4xx: './responses/4xx.yaml'
      200:
        description: item detail
        content:
          application/json:
            schema:
              type: object
              properties: 
                value:
                  $ref: '#/components/schemas/Item'
  delete:
    tags:
    - item
    description: Delete a item with given id
    operationId: deleteItem
    security:
    - bearerAuth: []
    parameters:
    - $ref#storeid: './parameters/storeid.yaml'
    - $ref#id: './parameters/objectid.yaml'
    responses:
      $ref#4xx: './responses/4xx.yaml'
      $ref#204: './responses/204.yaml'

/item/{storeid}/byname/{name}:
  get:
    tags:
    - item
    description: Return all the items/categories belong to the given store that queried by name
    operationId: getMenu
    security:
    - bearerAuth: []
    parameters:
    - $ref#storeid: './parameters/storeid.yaml'
    - name: name
      in: path
      required: true      
      description: The items/categories' name
      schema:
        type: string
    responses:
      $ref#4xx: './responses/4xx.yaml'
      200:
        description: list of item
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/Item'

/item/{storeid}/barcode/{barcode}:
  get:
    tags:
    - item
    description: Return the item by barcode
    operationId: loadItemByBarcode
    security:
    - bearerAuth: []
    parameters:
    - $ref#storeid: './parameters/storeid.yaml'
    - name: barcode
      in: path
      required: true      
      schema:
        type: string
    responses:
      $ref#4xx: './responses/4xx.yaml'
      200:
        description: item detail
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Item'


/item/{storeid}/sku/{sku}:
  get:
    tags:
    - item
    description: Return the item by sku
    operationId: loadItemBySku
    security:
    - bearerAuth: []
    parameters:
    - $ref#storeid: './parameters/storeid.yaml'
    - name: sku
      in: path
      required: true      
      schema:
        type: string
    responses:
      $ref#4xx: './responses/4xx.yaml'
      200:
        description: item detail
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Item'

/item/{storeid}/input:
  post:
    tags:
    - item
    description: Update stock item
    operationId: updateStockItem
    security:
    - bearerAuth: []
    parameters:
    - $ref#storeid: './parameters/storeid.yaml'
    requestBody:
      required: true
      content:
        application/json: 
          schema:
            type: array
            items:
                $ref: '#/components/schemas/ItemStockDetail'
    responses:
      $ref#4xx: './responses/4xx.yaml'
      $ref#upsert: './responses/20x-upsert.yaml'


/item/{storeid}/bulk-update:
  post:
    tags:
    - item
    description: Bulk update item
    operationId: bulkUpdateItem
    security:
    - bearerAuth: []
    parameters:
    - $ref#storeid: './parameters/storeid.yaml'
    requestBody:
      required: true
      content:
        application/json: 
          schema: 
            type: object
            properties:
              items: 
                type: array
                items:
                    $ref: '#/components/schemas/Item'
    responses:
      $ref#4xx: './responses/4xx.yaml'
      $ref#upsert: './responses/20x-upsert.yaml'