openapi: 3.0.3
info:
  title: Pizza Ordering API
  description: API for ordering and customizing pizzas.
  version: 1.0.0
servers:
  - url: https://pizzaorderapi.com
    description: Production server
paths:
  /menu:
    get:
      summary: Get available pizzas
      description: Fetch the list of available pizzas.
      responses:
        200:
          description: List of pizzas
          content:
            application/json:
              schema:
                type: object
                properties:
                  menu:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 1
                        name:
                          type: string
                          example: Margherita
                        description:
                          type: string
                          example: Classic pizza with tomato sauce, mozzarella, and basil.
                        price:
                          type: number
                          format: float
                          example: 8.99
                        sizes:
                          type: array
                          items:
                            type: string
                            example: medium
  /customizations:
    get:
      summary: Get customization options
      description: Fetch available toppings, crust types, and sauces for customization.
      responses:
        200:
          description: Customization options
          content:
            application/json:
              schema:
                type: object
                properties:
                  toppings:
                    type: array
                    items:
                      type: string
                      example: mushrooms
                  crusts:
                    type: array
                    items:
                      type: string
                      example: thin
                  sauces:
                    type: array
                    items:
                      type: string
                      example: marinara
  /orders:
    post:
      summary: Place a pizza order
      description: Place an order for a pizza.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                customer:
                  type: object
                  properties:
                    name:
                      type: string
                      example: John Doe
                    phone:
                      type: string
                      example: "+1234567890"
                    address:
                      type: string
                      example: "123 Pizza Street, Food City"
                order:
                  type: object
                  properties:
                    pizza_id:
                      type: integer
                      example: 1
                    size:
                      type: string
                      example: large
                    toppings:
                      type: array
                      items:
                        type: string
                        example: extra cheese
                    crust:
                      type: string
                      example: thin
                    quantity:
                      type: integer
                      example: 2
                payment:
                  type: object
                  properties:
                    method:
                      type: string
                      example: credit_card
                    card_number:
                      type: string
                      example: "4111111111111111"
                    expiry:
                      type: string
                      example: "12/24"
                    cvv:
                      type: string
                      example: "123"
      responses:
        200:
          description: Order confirmation
          content:
            application/json:
              schema:
                type: object
                properties:
                  order_id:
                    type: integer
                    example: 4567
                  status:
                    type: string
                    example: confirmed
                  estimated_delivery_time:
                    type: string
                    example: 30 minutes
  /orders/{order_id}/status:
    get:
      summary: Track order status
      description: Track the status of an existing order.
      parameters:
        - in: path
          name: order_id
          required: true
          schema:
            type: integer
          description: The ID of the order.
      responses:
        200:
          description: Order status
          content:
            application/json:
              schema:
                type: object
                properties:
                  order_id:
                    type: integer
                    example: 4567
                  status:
                    type: string
                    example: Out for delivery
                  estimated_delivery_time:
                    type: string
                    example: 15 minutes
  /locations:
    get:
      summary: Get delivery locations
      description: Fetch areas where delivery is available.
      responses:
        200:
          description: Delivery locations
          content:
            application/json:
              schema:
                type: object
                properties:
                  locations:
                    type: array
                    items:
                      type: string
                      example: Downtown
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              example: 400
            message:
              type: string
              example: Invalid pizza size selected.
