openapi: 3.0.1
info:
  title: Evolution Foundation - Auth Service - Profile
  description: Authentication and user and account management
  version: v1.0.0
servers:
- url: https://api.evoai.app
  description: Production server
- url: http://localhost:3001
  description: Development server
  variables:
    port:
      default: '3001'
- url: '{customUrl}'
  description: Custom server
  variables:
    customUrl:
      default: https://your-instance.com
      description: Enter your server URL
paths:
  /api/v1/profile:
    get:
      summary: Get user profile
      description: Get current authenticated user profile with accounts
      operationId: getProfile
      security:
      - ApiAccessTokenAuth: []
      responses:
        '200':
          description: Profile retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      user:
                        $ref: '#/components/schemas/UserProfile'
                      accounts:
                        type: array
                        items:
                          $ref: '#/components/schemas/Account'
                        description: Array of user accounts
                  meta:
                    type: object
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Response timestamp
                        example: '2026-01-28T22:32:23Z'
                  message:
                    type: string
                    description: Success message
                    example: Profile retrieved successfully
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validation_error:
                  summary: Invalid request parameters
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: Invalid request parameters
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile
                      method: GET
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Unauthorized access
                  value:
                    success: false
                    error:
                      code: INVALID_TOKEN
                      message: Invalid token
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile
                      method: GET
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  summary: Access forbidden
                  value:
                    success: false
                    error:
                      code: FORBIDDEN
                      message: You do not have permission to access this resource
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile
                      method: GET
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                not_found:
                  summary: Profile not found
                  value:
                    success: false
                    error:
                      code: NOT_FOUND
                      message: User profile not found
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile
                      method: GET
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: Internal server error
                  value:
                    success: false
                    error:
                      code: INTERNAL_ERROR
                      message: An unexpected error occurred
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile
                      method: GET
    put:
      summary: Update user profile
      description: Update current user profile information
      operationId: updateProfile
      security:
      - ApiAccessTokenAuth: []
      responses:
        '200':
          description: Profile updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/UserProfile'
                  meta:
                    type: object
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Response timestamp
                        example: '2026-01-28T22:32:23Z'
                  message:
                    type: string
                    description: Success message
                    example: Profile updated successfully
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validation_error:
                  summary: Invalid request parameters
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: Invalid request parameters
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile
                      method: PUT
                invalid_email:
                  summary: Invalid email format
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: Invalid email format
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile
                      method: PUT
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Unauthorized access
                  value:
                    success: false
                    error:
                      code: INVALID_TOKEN
                      message: Invalid token
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile
                      method: PUT
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  summary: Access forbidden
                  value:
                    success: false
                    error:
                      code: FORBIDDEN
                      message: You do not have permission to access this resource
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile
                      method: PUT
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                not_found:
                  summary: Profile not found
                  value:
                    success: false
                    error:
                      code: NOT_FOUND
                      message: User profile not found
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile
                      method: PUT
        '422':
          description: Unprocessable Entity (validation errors)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validation_errors:
                  summary: Validation errors
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: Validation failed
                      details:
                        email:
                        - has already been taken
                        - is invalid
                        name:
                        - is too short (minimum is 2 characters)
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile
                      method: PUT
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: Internal server error
                  value:
                    success: false
                    error:
                      code: INTERNAL_ERROR
                      message: An unexpected error occurred
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile
                      method: PUT
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: User full name
                  example: John Doe
                email:
                  type: string
                  format: email
                  description: User email address
                  example: john.doe@example.com
                display_name:
                  type: string
                  description: User display name
                  example: John
                message_signature:
                  type: string
                  description: Email signature
                  example: Best regards, John
                custom_attributes:
                  type: object
                  additionalProperties: true
                  description: Custom user attributes
                ui_settings:
                  type: object
                  additionalProperties: true
                  description: UI preferences and settings
                avatar:
                  type: string
                  format: binary
                  description: Avatar image file (base64 encoded or URL)
  /api/v1/profile/avatar:
    put:
      summary: Update profile avatar
      description: Update user avatar image
      operationId: updateProfileAvatar
      security:
      - ApiAccessTokenAuth: []
      responses:
        '200':
          description: Avatar updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      avatar_url:
                        type: string
                        description: URL of the updated avatar image
                        example: https://example.com/avatars/user123.jpg
                  meta:
                    type: object
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Response timestamp
                        example: '2026-01-28T22:32:23Z'
                  message:
                    type: string
                    description: Success message
                    example: Avatar updated successfully
              example:
                success: true
                data:
                  avatar_url: https://example.com/avatars/user123.jpg
                meta:
                  timestamp: '2026-01-28T22:32:23Z'
                message: Avatar updated successfully
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validation_error:
                  summary: Invalid file format
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: Invalid file format. Only image files are allowed
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/avatar
                      method: PUT
                file_too_large:
                  summary: File too large
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: File size exceeds maximum allowed size
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/avatar
                      method: PUT
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Unauthorized access
                  value:
                    success: false
                    error:
                      code: INVALID_TOKEN
                      message: Invalid token
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/avatar
                      method: PUT
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  summary: Access forbidden
                  value:
                    success: false
                    error:
                      code: FORBIDDEN
                      message: You do not have permission to access this resource
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/avatar
                      method: PUT
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                not_found:
                  summary: Profile not found
                  value:
                    success: false
                    error:
                      code: NOT_FOUND
                      message: User profile not found
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/avatar
                      method: PUT
        '422':
          description: Unprocessable Entity (validation errors)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validation_errors:
                  summary: Validation errors
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: Validation failed
                      details:
                        avatar:
                        - is required
                        - must be an image file
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/avatar
                      method: PUT
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: Internal server error
                  value:
                    success: false
                    error:
                      code: INTERNAL_ERROR
                      message: An unexpected error occurred
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/avatar
                      method: PUT
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                avatar:
                  type: string
                  format: binary
                  description: Avatar image file
  /api/v1/profile/notifications:
    get:
      summary: Get notification preferences
      description: Get user notification preferences
      operationId: getNotificationPreferences
      security:
      - ApiAccessTokenAuth: []
      responses:
        '200':
          description: Notification preferences retrieved
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      email_notifications:
                        type: boolean
                        description: Email notifications enabled
                        example: true
                      push_notifications:
                        type: boolean
                        description: Push notifications enabled
                        example: true
                      marketing_emails:
                        type: boolean
                        description: Marketing emails enabled
                        example: false
                      security_alerts:
                        type: boolean
                        description: Security alerts enabled
                        example: true
                  meta:
                    type: object
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Response timestamp
                        example: '2026-01-29T15:13:24Z'
                  message:
                    type: string
                    description: Success message
                    example: Notification preferences retrieved successfully
              example:
                success: true
                data:
                  email_notifications: true
                  push_notifications: true
                  marketing_emails: false
                  security_alerts: true
                meta:
                  timestamp: '2026-01-29T15:13:24Z'
                message: Notification preferences retrieved successfully
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validation_error:
                  summary: Invalid request parameters
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: Invalid request parameters
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/notifications
                      method: GET
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Unauthorized access
                  value:
                    success: false
                    error:
                      code: INVALID_TOKEN
                      message: Invalid token
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/notifications
                      method: GET
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  summary: Access forbidden
                  value:
                    success: false
                    error:
                      code: FORBIDDEN
                      message: You do not have permission to access this resource
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/notifications
                      method: GET
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                not_found:
                  summary: Profile not found
                  value:
                    success: false
                    error:
                      code: NOT_FOUND
                      message: User profile not found
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/notifications
                      method: GET
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: Internal server error
                  value:
                    success: false
                    error:
                      code: INTERNAL_ERROR
                      message: An unexpected error occurred
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/notifications
                      method: GET
    put:
      summary: Update notification preferences
      description: Update user notification preferences
      operationId: updateNotificationPreferences
      security:
      - ApiAccessTokenAuth: []
      responses:
        '200':
          description: Preferences updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      email_notifications:
                        type: boolean
                        description: Email notifications enabled
                        example: true
                      push_notifications:
                        type: boolean
                        description: Push notifications enabled
                        example: true
                      marketing_emails:
                        type: boolean
                        description: Marketing emails enabled
                        example: false
                      security_alerts:
                        type: boolean
                        description: Security alerts enabled
                        example: true
                  meta:
                    type: object
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Response timestamp
                        example: '2026-01-28T22:32:23Z'
                  message:
                    type: string
                    description: Success message
                    example: Notification preferences updated successfully
              example:
                success: true
                data:
                  email_notifications: true
                  push_notifications: true
                  marketing_emails: false
                  security_alerts: true
                meta:
                  timestamp: '2026-01-28T22:32:23Z'
                message: Notification preferences updated successfully
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validation_error:
                  summary: Invalid request parameters
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: Invalid request parameters
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/notifications
                      method: PUT
                invalid_boolean:
                  summary: Invalid boolean value
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: All preference fields must be boolean values
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/notifications
                      method: PUT
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Unauthorized access
                  value:
                    success: false
                    error:
                      code: INVALID_TOKEN
                      message: Invalid token
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/notifications
                      method: PUT
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  summary: Access forbidden
                  value:
                    success: false
                    error:
                      code: FORBIDDEN
                      message: You do not have permission to access this resource
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/notifications
                      method: PUT
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                not_found:
                  summary: Profile not found
                  value:
                    success: false
                    error:
                      code: NOT_FOUND
                      message: User profile not found
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/notifications
                      method: PUT
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: Internal server error
                  value:
                    success: false
                    error:
                      code: INTERNAL_ERROR
                      message: An unexpected error occurred
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/notifications
                      method: PUT
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email_notifications:
                  type: boolean
                  description: Enable or disable email notifications
                  example: true
                push_notifications:
                  type: boolean
                  description: Enable or disable push notifications
                  example: true
                marketing_emails:
                  type: boolean
                  description: Enable or disable marketing emails
                  example: false
                security_alerts:
                  type: boolean
                  description: Enable or disable security alerts
                  example: true
  /api/v1/profile/password:
    put:
      summary: Update profile password
      description: Update current user password
      operationId: updateProfilePassword
      security:
      - ApiAccessTokenAuth: []
      responses:
        '200':
          description: Password updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    description: Empty object indicating successful operation
                    example: {}
                  meta:
                    type: object
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Response timestamp
                        example: '2026-01-28T22:32:23Z'
                  message:
                    type: string
                    description: Success message
                    example: Password updated successfully
              example:
                success: true
                data: {}
                meta:
                  timestamp: '2026-01-28T22:32:23Z'
                message: Password updated successfully
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_current_password:
                  summary: Invalid current password
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: Current password is incorrect
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/password
                      method: PUT
                password_too_short:
                  summary: Password too short
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: New password must be at least 8 characters long
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/password
                      method: PUT
                missing_fields:
                  summary: Missing required fields
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: Current password and new password are required
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/password
                      method: PUT
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Unauthorized access
                  value:
                    success: false
                    error:
                      code: INVALID_TOKEN
                      message: Invalid token
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/password
                      method: PUT
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  summary: Access forbidden
                  value:
                    success: false
                    error:
                      code: FORBIDDEN
                      message: You do not have permission to access this resource
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/password
                      method: PUT
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                not_found:
                  summary: Profile not found
                  value:
                    success: false
                    error:
                      code: NOT_FOUND
                      message: User profile not found
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/password
                      method: PUT
        '422':
          description: Unprocessable Entity (validation errors)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validation_errors:
                  summary: Validation errors
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: Validation failed
                      details:
                        current_password:
                        - is required
                        new_password:
                        - is too short (minimum is 8 characters)
                        - must contain at least one uppercase letter
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/password
                      method: PUT
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: Internal server error
                  value:
                    success: false
                    error:
                      code: INTERNAL_ERROR
                      message: An unexpected error occurred
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/profile/password
                      method: PUT
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                current_password:
                  type: string
                  description: Current user password for verification
                  example: currentPassword123
                new_password:
                  type: string
                  minLength: 8
                  description: New password (minimum 8 characters)
                  example: newPassword123
              required:
              - current_password
              - new_password
components:
  schemas:
    Account:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Account unique identifier
        name:
          type: string
          description: Account name
        domain:
          type: string
          nullable: true
          description: Account custom domain
        support_email:
          type: string
          format: email
          nullable: true
          description: Support email address
        locale:
          type: string
          enum:
          - en
          - pt
          - pt_BR
          - es
          - fr
          - de
          description: Account locale
        status:
          type: string
          enum:
          - active
          - suspended
          description: Account status
        settings:
          type: object
          additionalProperties: true
          description: Account settings
        custom_attributes:
          type: object
          additionalProperties: true
          description: Custom account attributes
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        role:
          type: string
          description: User role in this account
    ErrorResponse:
      type: object
      required:
      - success
      - error
      - meta
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          required:
          - code
          - message
          properties:
            code:
              type: string
              example: VALIDATION_ERROR
            message:
              type: string
              example: Validation failed
            details:
              type: object
              additionalProperties: true
              nullable: true
        meta:
          type: object
          required:
          - timestamp
          - path
          - method
          properties:
            timestamp:
              type: string
              format: date-time
              example: '2024-01-15T10:30:00Z'
            path:
              type: string
              example: /api/v1/super_admin/accounts/123
            method:
              type: string
              example: POST
    UserProfile:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: User unique identifier
        name:
          type: string
          description: User full name
        email:
          type: string
          format: email
          description: User email address
        type:
          type: string
          enum:
          - User
          - SuperAdmin
          description: User type
        role:
          type: object
          nullable: true
          properties:
            id:
              type: string
              format: uuid
            key:
              type: string
            name:
              type: string
          description: User role information
        pubsub_token:
          type: string
          description: Token for real-time communication
        display_name:
          type: string
          nullable: true
          description: User display name
        available_name:
          type: string
          description: Name or email fallback
        availability:
          type: string
          enum:
          - online
          - busy
          - offline
          description: User availability status
        mfa_enabled:
          type: boolean
          description: Whether MFA is enabled
        confirmed:
          type: boolean
          description: Whether email is confirmed
        confirmed_at:
          type: string
          format: date-time
          nullable: true
          description: Email confirmation timestamp
        avatar_url:
          type: string
          nullable: true
          description: URL to user avatar
        custom_attributes:
          type: object
          additionalProperties: true
          description: Custom user attributes
        ui_settings:
          type: object
          additionalProperties: true
          description: User interface settings
        is_super_admin:
          type: boolean
          description: Whether user is super admin
        created_at:
          type: string
          format: date-time
          description: Creation timestamp
        updated_at:
          type: string
          format: date-time
          description: Last update timestamp
    DataExportResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          additionalProperties: true
        meta:
          type: object
          properties:
            timestamp:
              type: string
              format: date-time
              example: '2024-01-01T00:00:00Z'
        message:
          type: string
          example: User data exported successfully
    DataPrivacyConsent:
      type: object
      description: Data Privacy Consent information
      properties:
        id:
          type: string
          format: uuid
          description: Consent unique identifier
        user_id:
          type: string
          format: uuid
          description: User ID
        consent_type:
          type: string
          enum:
          - data_processing
          - marketing_communications
          - analytics_tracking
          - third_party_sharing
          - profiling
          - automated_decision_making
          - data_retention
          - cross_border_transfer
          - sensitive_data_processing
          - cookies_functional
          - cookies_analytics
          - cookies_marketing
          description: Type of consent
        granted:
          type: boolean
          description: Whether consent is granted
        granted_at:
          type: string
          format: date-time
          nullable: true
          description: When consent was granted
        revoked_at:
          type: string
          format: date-time
          nullable: true
          description: When consent was revoked
        legal_basis:
          type: string
          enum:
          - consent
          - contract
          - legal_obligation
          - vital_interests
          - public_task
          - legitimate_interests
          nullable: true
          description: Legal basis for processing
        purpose_description:
          type: string
          nullable: true
          description: Purpose description
        expires_at:
          type: string
          format: date-time
          nullable: true
          description: When consent expires
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
  securitySchemes:
    DeviseTokenAuth:
      type: apiKey
      in: header
      name: access-token
      description: Devise Token Auth - requires access-token, client, and uid headers
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    SuperAdminAuth:
      type: apiKey
      in: header
      name: api_access_token
      description: Super Admin authentication token
    ApiAccessTokenAuth:
      type: apiKey
      in: header
      name: api_access_token
      description: API access token authentication
