openapi: 3.1.0
info:
  title: Storefront Pickup Options
  version: 1.0.0
paths:
  /pickup-options:
    post:
      operationId: post-pickup-options
      summary: Find Available Pickup Options
      description: >-
        Returns up to 10 available pickup options for the requested items around a radius of the provided search
        coordinates. 


        The pickup options returned only include options where all requested items are available and can be picked up
        from a single location.
      tags:
        - pickupOptions
      parameters:
        - name: Accept
          in: header
          description: >-
            The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of the response
            body.
          required: true
          schema:
            type: string
            default: application/json
      responses:
        '200':
          description: The request has been successfully processed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pickup Options_post-pickup-options_Response_200'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PickupRequestPayload'
servers:
  - url: https://your_store.example.com/api/storefront
    description: https://{store_domain}/api/storefront
components:
  schemas:
    SearchAreaRadiusUnit:
      type: string
      enum:
        - KM
        - MI
      title: SearchAreaRadiusUnit
    SearchAreaRadius:
      type: object
      properties:
        value:
          type: integer
        unit:
          $ref: '#/components/schemas/SearchAreaRadiusUnit'
      description: Radius around the coordinates where you are searching for pickup options.
      title: SearchAreaRadius
    Coordinates:
      type: object
      properties:
        latitude:
          type: number
          format: double
        longitude:
          type: number
          format: double
      description: Coordinates where you are searching for pickup options.
      title: Coordinates
    SearchArea:
      type: object
      properties:
        radius:
          $ref: '#/components/schemas/SearchAreaRadius'
          description: Radius around the coordinates where you are searching for pickup options.
        coordinates:
          $ref: '#/components/schemas/Coordinates'
      description: Area where you are searching for pickup options.
      title: SearchArea
    Item:
      type: object
      properties:
        variantId:
          type: integer
        quantity:
          type: integer
      title: Item
    PickupRequestPayload:
      type: object
      properties:
        searchArea:
          $ref: '#/components/schemas/SearchArea'
        items:
          type: array
          items:
            $ref: '#/components/schemas/Item'
          description: Items you include in your search for pickup options.
      title: PickupRequestPayload
    PickupMethod:
      type: object
      properties:
        id:
          type: integer
        locationId:
          type: integer
        displayName:
          type: string
        collectionInstructions:
          type: string
        collectionTimeDescription:
          type: string
      description: Pickup method that can be used with the available items.
      title: PickupMethod
    AvailableItem:
      type: object
      properties:
        variantId:
          type: integer
        quantity:
          type: integer
      title: AvailableItem
    PickupOption:
      type: object
      properties:
        pickupMethod:
          $ref: '#/components/schemas/PickupMethod'
        availableItems:
          type: array
          items:
            $ref: '#/components/schemas/AvailableItem'
          description: Items that are available using the pickup method.
      title: PickupOption
    PickupOptionsResponse:
      type: object
      properties:
        pickupOptions:
          type: array
          items:
            $ref: '#/components/schemas/PickupOption'
          description: Pickup options for the available items.
      title: PickupOptionsResponse
    Pickup Options_post-pickup-options_Response_200:
      type: object
      properties:
        results:
          type: array
          items:
            $ref: '#/components/schemas/PickupOptionsResponse'
      title: Pickup Options_post-pickup-options_Response_200
