openapi: 3.0.3
info:
  title: Ahaar QR Online Orders API
  version: 1.0.0
  description: API for integrating external online portal orders into Ahaar QR
paths:
  /online_orders/api/v1/restautant/:
    get:
      operationId: online_orders_api_v1_restautant_list
      description: Retrieves a list of all active restaurants/hotels participating
        in the online orders platform.
      summary: List Active Hotels
      tags:
      - online_orders
      security:
      - basicAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Restaurant'
          description: ''
  /online_orders/api/v1/restautant/{restaurant_id}/menu/:
    get:
      operationId: online_orders_api_v1_restautant_menu_retrieve
      description: Fetches the full active menu for a specific restaurant grouped
        by category.
      summary: Get Hotel Menu
      parameters:
      - in: path
        name: restaurant_id
        schema:
          type: integer
        description: ID of the restaurant
        required: true
      tags:
      - online_orders
      security:
      - basicAuth: []
      responses:
        '200':
          description: No response body
  /online_orders/api/v1/restautant/{restaurant_id}/orders/:
    post:
      operationId: online_orders_api_v1_restautant_orders_create
      description: Submits a new order for a specific restaurant from an online portal.
      summary: Place an Order
      parameters:
      - in: path
        name: restaurant_id
        schema:
          type: integer
        description: ID of the restaurant
        required: true
      tags:
      - online_orders
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderCreate'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/OrderCreate'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/OrderCreate'
        required: true
      security:
      - basicAuth: []
      responses:
        '201':
          description: Order placed successfully and is pending restaurant acceptance.
  /online_orders/dashboard/:
    get:
      operationId: online_orders_dashboard_retrieve
      tags:
      - online_orders
      security:
      - cookieAuth: []
      - basicAuth: []
      - {}
      responses:
        '200':
          description: No response body
  /online_orders/orders/{order_id}/accept/:
    post:
      operationId: online_orders_orders_accept_create
      parameters:
      - in: path
        name: order_id
        schema:
          type: integer
        required: true
      tags:
      - online_orders
      security:
      - cookieAuth: []
      - basicAuth: []
      - {}
      responses:
        '200':
          description: No response body
components:
  schemas:
    OrderCreate:
      type: object
      properties:
        restaurant_id:
          type: integer
        customer_name:
          type: string
          maxLength: 100
        customer_mobile:
          type: string
          maxLength: 20
        payment_status:
          type: string
          default: Pending
          maxLength: 50
        items:
          type: array
          items:
            $ref: '#/components/schemas/OrderItemCreate'
      required:
      - items
      - restaurant_id
    OrderItemCreate:
      type: object
      properties:
        item_id:
          type: integer
        quantity:
          type: integer
        price:
          type: string
          format: decimal
          pattern: ^-?\d{0,8}(?:\.\d{0,2})?$
        remarks:
          type: string
          maxLength: 500
      required:
      - item_id
      - price
      - quantity
    Restaurant:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        restaurant_name:
          type: string
          nullable: true
          maxLength: 250
        restaurant_img:
          type: string
          nullable: true
          maxLength: 250
        restaurant_address:
          type: string
          nullable: true
          maxLength: 250
        city:
          type: string
          nullable: true
          maxLength: 150
        state:
          type: string
          nullable: true
          maxLength: 150
        postal_code:
          type: string
          nullable: true
          maxLength: 15
        logo:
          type: string
          nullable: true
          maxLength: 200
        mobile_no:
          type: string
          nullable: true
          maxLength: 40
        status:
          type: string
          nullable: true
          maxLength: 8
      required:
      - id
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
    cookieAuth:
      type: apiKey
      in: cookie
      name: sessionid
