openapi: 3.0.0
info:
  title: Order Tracking API
  description: API for tracking order delivery status in real-time
  version: 1.0.0
  contact:
    name: Support
    url: https://ibm-wx-tools.egodev1.info

servers:
  - url: https://ibm-wx-tools.egodev1.info
    description: Production server
  - url: http://localhost
    description: Development server

paths:
  /tracking.php:
    get:
      summary: Get order delivery status
      description: Returns detailed information about order delivery status by order number
      operationId: getOrderTracking
      tags:
        - Tracking
      parameters:
        - name: order_number
          in: query
          description: Order number to track (for example ORD-001)
          required: true
          schema:
            type: string
            example: "ORD-001"
      responses:
        '200':
          description: Order found, delivery status information returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      order_number:
                        type: string
                        description: Order number
                        example: "ORD-001"
                      status:
                        type: string
                        description: Delivery status (delivered, in_transit, at_warehouse, out_for_delivery, processing, lost, cancelled, waiting_pickup)
                        enum: [delivered, in_transit, at_warehouse, out_for_delivery, processing, lost, cancelled, waiting_pickup]
                        example: "in_transit"
                      status_text:
                        type: string
                        description: Human-readable status description
                        example: "In Transit"
                      location:
                        type: string
                        description: Current package location
                        example: "Berlin, Germany"
                      delivery_date:
                        type: string
                        format: date
                        description: Expected delivery date
                        example: "2025-11-30"
                      courier:
                        type: string
                        description: Courier service name
                        example: "DHL Express"
                  timestamp:
                    type: string
                    format: date-time
                    description: Time information was retrieved
                    example: "2025-11-28 16:30:45"

        '400':
          description: The order_number parameter was not provided
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: "Parameter order_number is required"
                  code:
                    type: string
                    example: "MISSING_PARAMETER"

        '404':
          description: Order not found in the system
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: "Order with number 'ORD-999' not found in system"
                  order_number:
                    type: string
                    example: "ORD-999"
                  code:
                    type: string
                    example: "ORDER_NOT_FOUND"

        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: "Internal server error"

components:
  schemas:
    Order:
      type: object
      required:
        - order_number
        - status
        - location
      properties:
        order_number:
          type: string
          description: Unique order number
          example: "ORD-001"
        status:
          type: string
          description: Current delivery status
          enum: [delivered, in_transit, at_warehouse, out_for_delivery, processing, lost, cancelled, waiting_pickup]
        status_text:
          type: string
          description: Status description in English
        location:
          type: string
          description: Current location
        delivery_date:
          type: string
          format: date
          nullable: true
          description: Expected delivery date
        courier:
          type: string
          description: Courier service

tags:
  - name: Tracking
    description: API for order delivery tracking
