openapi: 3.0.0
info:
  title: Restaurant-Delivery Marketplace
  version: 1.0.0
servers:
  - url: http://{{backend_url}}
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
tags:
  - name: Users
  - name: Auth
  - name: Auth > Restaurant
  - name: Auth > Driver
  - name: Restaurants
  - name: Restaurants > Products
  - name: Restaurants > Admin
  - name: Delivery
  - name: Delivery > Manage Delivery
  - name: Cart + Checkout
paths:
  /users:
    post:
      tags:
        - Users
      summary: Create Driver
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                email: driver@gmail.com
                first_name: driver
                last_name: test
                phone: '1234566'
                actor_type: driver
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /auth/restaurant/emailpass:
    post:
      tags:
        - Auth > Restaurant
      summary: Authenticated JWT Token
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                email: admin@restaurant.com
                password: supersecret
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /auth/restaurant/emailpass/register:
    post:
      tags:
        - Auth > Restaurant
      summary: Registration JWT Token
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                email: admin@restaurant.com
                password: supersecret
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /auth/driver/emailpass:
    post:
      tags:
        - Auth > Driver
      summary: Authenticated JWT Token
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                email: driver@gmail.com
                password: supersecret
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /auth/driver/emailpass/register:
    post:
      tags:
        - Auth > Driver
      summary: Registration JWT Token
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                email: driver@gmail.com
                password: supersecret
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /restaurants/res_01J5X704WQTFSZMRC7Z6S3YAC7/products:
    post:
      tags:
        - Restaurants > Products
      summary: Create
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                products:
                  - title: Sushi
                    status: published
                    variants:
                      - title: Default
                        prices:
                          - currency_code: eur
                            amount: 20
                        manage_inventory: false
                    sales_channels:
                      - id: sc_01J5ZWK4MKJF85PM8KTW0BWMCK
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
    delete:
      tags:
        - Restaurants > Products
      summary: Delete Product
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /restaurants/01J7GHGQTCAVY5C1AH1H733Q4G/admins/01J7GHXP74NA4TCST3QMD1E9VC:
    delete:
      tags:
        - Restaurants > Admin
      summary: Delete Admin
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /restaurants:
    post:
      tags:
        - Restaurants
      summary: Create Restaurant
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                name: Acme
                handle: acme
                address: 1st street
                phone: '1234567'
                email: acme@restaurant.com
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
    get:
      tags:
        - Restaurants
      summary: List Restaurant
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /deliveries/del_01J5ZWRTGJ2PRJY167TEMVVRRC/accept:
    post:
      tags:
        - Delivery > Manage Delivery
      summary: Accept Order (Restaurant)
      requestBody:
        content: {}
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /deliveries/del_01J5ZWRTGJ2PRJY167TEMVVRRC/claim:
    post:
      tags:
        - Delivery > Manage Delivery
      summary: Claim Delivery
      requestBody:
        content: {}
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /deliveries/del_01J5ZVFVWCGTJ2JGA7VNGPPF9D/prepare:
    post:
      tags:
        - Delivery > Manage Delivery
      summary: Prepare Order
      requestBody:
        content: {}
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /deliveries/del_01J5ZVFVWCGTJ2JGA7VNGPPF9D/ready:
    post:
      tags:
        - Delivery > Manage Delivery
      summary: Preparation Done (Ready)
      requestBody:
        content: {}
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /deliveries/del_01J5ZVFVWCGTJ2JGA7VNGPPF9D/pick-up:
    post:
      tags:
        - Delivery > Manage Delivery
      summary: Pick up delivery
      requestBody:
        content: {}
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /deliveries/del_01J66T30X5WR4HD58VNGNACMM6/complete:
    post:
      tags:
        - Delivery > Manage Delivery
      summary: Complete Delivery
      requestBody:
        content: {}
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/deliveries:
    post:
      tags:
        - Delivery
      summary: Create New Order Delivery
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                cart_id: cart_01J67MS5WPH2CE5R84BENJCGSW
                restaurant_id: res_01J66SYN5DSRR0R6QM3A4SYRFZ
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/deliveries/del_01J5ZAY421QCYB4NDZJV3PMX1Z/subscribe:
    get:
      tags:
        - Delivery
      summary: Subscribe to Delivery
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/deliveries/del_01J5ZAY421QCYB4NDZJV3PMX1Z:
    get:
      tags:
        - Delivery
      summary: Get Delivery
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/regions:
    get:
      tags:
        - Cart + Checkout
      summary: List Regions
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/carts:
    post:
      tags:
        - Cart + Checkout
      summary: Create Cart
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                region_id: reg_01J66SWSSWFZPQV0GWR2W7P1SB
                sales_channel_id: sc_01J66SWSRK95F2P2KTFHMYR7VC
                email: customer@gmail.com
                shipping_address:
                  first_name: customer
                  last_name: test
                  address_1: first street
                  country_code: dk
                  city: Copenhagen
                  postal_code: '1234'
                billing_address:
                  first_name: customer
                  last_name: test
                  address_1: first street
                  country_code: dk
                  city: Copenhagen
                  postal_code: '1234'
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/carts/cart_01J67MS5WPH2CE5R84BENJCGSW/line-items:
    post:
      tags:
        - Cart + Checkout
      summary: Add Product Variant to Cart
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                variant_id: variant_01J66T0VC2S0NB4BNDBCZN8P9F
                quantity: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/shipping-options:
    get:
      tags:
        - Cart + Checkout
      summary: List Shipping Options
      parameters:
        - name: cart_id
          in: query
          schema:
            type: string
          example: cart_01J5ZWQCY6WR1ME7JA6WG6XVV6
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/carts/cart_01J67JT10B3RCWKT9NFEFYA2XG/shipping-methods:
    post:
      tags:
        - Cart + Checkout
      summary: Set Shipping Method
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                option_id: so_01J66SWSVQG7S1BSJKR7PYWH6C
                data: {}
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/payment-providers:
    get:
      tags:
        - Cart + Checkout
      summary: Retrieve Payment Providers
      parameters:
        - name: region_id
          in: query
          schema:
            type: string
          example: reg_01J5ZW6M92BKGKS0WT215VFDEJ
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/payment-collections:
    post:
      tags:
        - Cart + Checkout
      summary: Create Payment Collection
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                cart_id: cart_01J67JT10B3RCWKT9NFEFYA2XG
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /store/payment-collections/pay_col_01J67JWNGF88Y359FTYMBGDZGS/payment-sessions:
    post:
      tags:
        - Cart + Checkout
      summary: Initialize Payment Session
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                provider_id: pp_system_default
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
