openapi: 3.0.0
info:
  title: Product Management Microservice API
  description: |
    Product catalog and inventory management microservice.
    Handles product listings, categories, inventory, and product information.
    
    **Database**: emmanylcode_product
    **Service ID**: product-service
    **Version**: 1.0.0
  version: 1.0.0

servers:
  - url: http://localhost/projects/SMS-MICROSERVICES/product-service/public
    description: Development Product Service
  - url: https://product.emmanylcode.local
    description: Production Product Service

security:
  - BearerAuth: []

components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

  schemas:
    Product:
      type: object
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        description:
          type: string
        price:
          type: number
          format: float
        quantity:
          type: integer
        sku:
          type: string
        category_id:
          type: integer
        image_url:
          type: string
          format: uri
        status:
          type: string
          enum: [active, inactive, discontinued]
        created_at:
          type: string
          format: date-time

paths:
  /api/products:
    get:
      summary: List products
      description: Retrieve products with filtering and pagination
      operationId: listProducts
      tags:
        - Products
      parameters:
        - name: category_id
          in: query
          schema:
            type: integer
        - name: limit
          in: query
          schema:
            type: integer
            default: 20
        - name: offset
          in: query
          schema:
            type: integer
            default: 0
      responses:
        '200':
          description: Products retrieved
          content:
            application/json:
              schema:
                type: object
                properties:
                  products:
                    type: array
                    items:
                      $ref: '#/components/schemas/Product'
                  total:
                    type: integer

  /api/products/{productId}:
    get:
      summary: Get product details
      description: Retrieve detailed information about a specific product
      operationId: getProduct
      tags:
        - Products
      parameters:
        - name: productId
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Product details retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
        '404':
          description: Product not found

tags:
  - name: Products
    description: Product management endpoints
