openapi: 3.0.0
info:
  title: User Management Microservice API
  description: |
    User profile management, preferences, and account services microservice.
    Manages user data, profiles, settings, and account information.
    
    **Database**: emmanylcode_user
    **Service ID**: user-service
    **Version**: 1.0.0
  version: 1.0.0
  contact:
    name: Architecture Team
    email: support@emmanylcode.local
  license:
    name: Apache 2.0

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

security:
  - BearerAuth: []
  - ApiKeyAuth: []

components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token from auth service
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

  schemas:
    UserProfile:
      type: object
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        email:
          type: string
          format: email
        phone:
          type: string
        address:
          type: string
        role_id:
          type: integer
        avatar_url:
          type: string
          format: uri
        bio:
          type: string
        is_active:
          type: boolean
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time

    UserUpdateRequest:
      type: object
      properties:
        name:
          type: string
        phone:
          type: string
        address:
          type: string
        bio:
          type: string

paths:
  /api/users/{userId}:
    get:
      summary: Get user profile
      description: Retrieve user profile information by user ID
      operationId: getUserProfile
      tags:
        - User Profile
      parameters:
        - name: userId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        '200':
          description: User profile retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserProfile'
        '404':
          description: User not found
        '401':
          description: Unauthorized

    put:
      summary: Update user profile
      description: Update user profile information
      operationId: updateUserProfile
      tags:
        - User Profile
      parameters:
        - name: userId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserUpdateRequest'
      responses:
        '200':
          description: Profile updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserProfile'
        '400':
          description: Validation error
        '401':
          description: Unauthorized
        '404':
          description: User not found

tags:
  - name: User Profile
    description: User profile management endpoints
