openapi: 3.0.3
info:
  title: Kindly API - Advanced Systems
  description: |
    Enterprise-grade API with advanced AI capabilities including Zero-Knowledge Compression,
    Neural Topology Evolution, Quantum Prediction, and AGI Infrastructure.
    
    ## Features
    - 🔐 Zero-Knowledge Compression with homomorphic operations
    - 🧠 Self-evolving Neural Topology Transformer
    - ⚡ Quantum-aware prediction engine
    - 🤖 AGI-ready infrastructure with consciousness substrate
    - 🛡️ Military-grade security with SIMD-accelerated scanning
    - 📊 Real-time analytics with quantum caching
    
  version: 2.0.0
  contact:
    name: Kindly API Support
    email: support@kindly-api.com
  license:
    name: Proprietary
    url: https://kindly-api.com/license

servers:
  - url: https://api.kindly.com
    description: Production server
  - url: https://staging-api.kindly.com
    description: Staging server
  - url: http://localhost:3000
    description: Local development

security:
  - bearerAuth: []
  - apiKeyAuth: []

tags:
  - name: Authentication
    description: User authentication and authorization
  - name: Zero-Knowledge Compression
    description: Privacy-preserving data compression with homomorphic operations
  - name: Neural Topology
    description: Self-evolving neural architecture endpoints
  - name: Quantum Prediction
    description: Quantum-aware prediction and pattern recognition
  - name: AGI Infrastructure
    description: Artificial General Intelligence infrastructure
  - name: Context Extraction
    description: Seven-level context extraction and analysis
  - name: Analytics
    description: Real-time analytics with quantum caching
  - name: Tickets
    description: Support ticket management
  - name: Health
    description: System health and monitoring

paths:
  # Health Endpoints
  /api/health:
    get:
      tags:
        - Health
      summary: Basic health check
      description: Returns basic health status of the API
      security: []
      responses:
        '200':
          description: API is healthy
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HealthResponse'
              example:
                status: "ok"
                timestamp: "2024-01-08T12:00:00Z"

  /api/health/detailed:
    get:
      tags:
        - Health
      summary: Detailed health check
      description: Returns detailed health information including component status
      security: []
      responses:
        '200':
          description: Detailed health information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailedHealthResponse'

  # Authentication Endpoints
  /api/auth/register:
    post:
      tags:
        - Authentication
      summary: Register new user
      description: Creates a new user account with advanced AGI profile initialization
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RegisterRequest'
      responses:
        '201':
          description: User created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthResponse'
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'

  /api/auth/login:
    post:
      tags:
        - Authentication
      summary: User login
      description: Authenticates user and returns JWT tokens
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginRequest'
      responses:
        '200':
          description: Login successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthResponse'
        '401':
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'

  /api/auth/refresh:
    post:
      tags:
        - Authentication
      summary: Refresh access token
      description: Uses refresh token to obtain new access token
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RefreshRequest'
      responses:
        '200':
          description: Token refreshed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthResponse'

  /api/auth/logout:
    post:
      tags:
        - Authentication
      summary: Logout user
      description: Invalidates current session and tokens
      responses:
        '200':
          description: Logout successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: "Logged out successfully"

  # Zero-Knowledge Compression Endpoints
  /api/compression/compress:
    post:
      tags:
        - Zero-Knowledge Compression
      summary: Compress data with zero-knowledge proof
      description: |
        Compresses data while preserving privacy through zero-knowledge proofs.
        Supports multiple privacy levels and homomorphic operations.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompressionRequest'
      responses:
        '200':
          description: Data compressed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompressionResponse'
        '400':
          description: Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'

  /api/compression/decompress:
    post:
      tags:
        - Zero-Knowledge Compression
      summary: Decompress zero-knowledge compressed data
      description: Decompresses data while maintaining privacy guarantees
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DecompressionRequest'
      responses:
        '200':
          description: Data decompressed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DecompressionResponse'

  /api/compression/homomorphic-add:
    post:
      tags:
        - Zero-Knowledge Compression
      summary: Perform homomorphic addition
      description: |
        Adds two compressed values without decompressing them,
        maintaining zero-knowledge properties throughout the operation.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HomomorphicAddRequest'
      responses:
        '200':
          description: Homomorphic addition successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HomomorphicAddResponse'

  /api/compression/stats:
    get:
      tags:
        - Zero-Knowledge Compression
      summary: Get compression statistics
      description: Returns real-time statistics about compression operations
      responses:
        '200':
          description: Compression statistics
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompressionStats'

  # Neural Topology Endpoints (planned)
  /api/neural/evolve:
    post:
      tags:
        - Neural Topology
      summary: Trigger neural topology evolution
      description: |
        Initiates self-evolution of the neural architecture based on
        current data patterns and performance metrics.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NeuralEvolutionRequest'
      responses:
        '200':
          description: Evolution initiated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NeuralEvolutionResponse'

  /api/neural/transform:
    post:
      tags:
        - Neural Topology
      summary: Apply neural transformation
      description: Transforms input data through the evolved neural topology
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NeuralTransformRequest'
      responses:
        '200':
          description: Transformation successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NeuralTransformResponse'

  /api/neural/topology:
    get:
      tags:
        - Neural Topology
      summary: Get current neural topology
      description: Returns the current evolved state of the neural architecture
      responses:
        '200':
          description: Current topology information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NeuralTopologyInfo'

  # Quantum Prediction Endpoints (planned)
  /api/quantum/predict:
    post:
      tags:
        - Quantum Prediction
      summary: Generate quantum prediction
      description: |
        Uses quantum computing principles to generate probabilistic predictions
        with superposition of multiple future states.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QuantumPredictionRequest'
      responses:
        '200':
          description: Prediction generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuantumPredictionResponse'

  /api/quantum/entangle:
    post:
      tags:
        - Quantum Prediction
      summary: Create quantum entanglement
      description: Entangles multiple data streams for correlated predictions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QuantumEntangleRequest'
      responses:
        '200':
          description: Entanglement created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuantumEntangleResponse'

  /api/quantum/state:
    get:
      tags:
        - Quantum Prediction
      summary: Get quantum state
      description: Returns current quantum state information
      responses:
        '200':
          description: Quantum state information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuantumStateInfo'

  # AGI Infrastructure Endpoints (planned)
  /api/agi/consciousness/state:
    get:
      tags:
        - AGI Infrastructure
      summary: Get consciousness state
      description: Returns current state of the consciousness substrate
      responses:
        '200':
          description: Consciousness state information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConsciousnessState'

  /api/agi/knowledge/query:
    post:
      tags:
        - AGI Infrastructure
      summary: Query knowledge graph
      description: Performs semantic query on the AGI knowledge graph
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KnowledgeQueryRequest'
      responses:
        '200':
          description: Query results
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeQueryResponse'

  /api/agi/meta-cognitive/analyze:
    post:
      tags:
        - AGI Infrastructure
      summary: Perform meta-cognitive analysis
      description: Analyzes thought patterns and cognitive processes
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MetaCognitiveRequest'
      responses:
        '200':
          description: Analysis complete
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetaCognitiveResponse'

  # Context Extraction Endpoints
  /api/context/extract:
    post:
      tags:
        - Context Extraction
      summary: Extract seven-level context
      description: |
        Extracts context at seven levels:
        1. Immediate Context
        2. Component Context
        3. System Context
        4. Constraint Context
        5. Quality Context
        6. Business Context
        7. Evolution Context
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContextExtractionRequest'
      responses:
        '200':
          description: Context extracted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContextExtractionResponse'

  /api/context/info:
    get:
      tags:
        - Context Extraction
      summary: Get context extraction info
      description: Returns information about context extraction capabilities
      responses:
        '200':
          description: Context extraction information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContextInfo'

  # Analytics Endpoints
  /api/analytics/overview:
    get:
      tags:
        - Analytics
      summary: Get analytics overview
      description: Returns comprehensive analytics overview with quantum-cached data
      parameters:
        - name: start_date
          in: query
          schema:
            type: string
            format: date-time
        - name: end_date
          in: query
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: Analytics overview
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsOverview'

  /api/analytics/tickets:
    get:
      tags:
        - Analytics
      summary: Get ticket analytics
      description: Returns detailed ticket analytics
      parameters:
        - name: group_by
          in: query
          schema:
            type: string
            enum: [hour, day, week, month]
      responses:
        '200':
          description: Ticket analytics
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TicketAnalytics'

  # API Key Management
  /api/keys:
    get:
      tags:
        - Authentication
      summary: List API keys
      description: Returns list of user's API keys
      responses:
        '200':
          description: List of API keys
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ApiKey'

    post:
      tags:
        - Authentication
      summary: Create API key
      description: Creates a new API key for programmatic access
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateApiKeyRequest'
      responses:
        '201':
          description: API key created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyResponse'

  /api/keys/{key_id}:
    delete:
      tags:
        - Authentication
      summary: Revoke API key
      description: Revokes an existing API key
      parameters:
        - name: key_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '204':
          description: Key revoked successfully

components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT Bearer token authentication
    
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key authentication for programmatic access

  schemas:
    # Common schemas
    ErrorResponse:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
          description: Error code
        message:
          type: string
          description: Human-readable error message
        details:
          type: object
          description: Additional error details

    # Health schemas
    HealthResponse:
      type: object
      properties:
        status:
          type: string
          enum: [ok, degraded, error]
        timestamp:
          type: string
          format: date-time

    DetailedHealthResponse:
      type: object
      properties:
        status:
          type: string
          enum: [ok, degraded, error]
        timestamp:
          type: string
          format: date-time
        components:
          type: object
          properties:
            database:
              $ref: '#/components/schemas/ComponentHealth'
            cache:
              $ref: '#/components/schemas/ComponentHealth'
            quantum_cache:
              $ref: '#/components/schemas/ComponentHealth'
            neural_topology:
              $ref: '#/components/schemas/ComponentHealth'
            quantum_prediction:
              $ref: '#/components/schemas/ComponentHealth'
            agi_infrastructure:
              $ref: '#/components/schemas/ComponentHealth'
        metrics:
          type: object
          properties:
            uptime_seconds:
              type: integer
            request_count:
              type: integer
            avg_response_time_ms:
              type: number

    ComponentHealth:
      type: object
      properties:
        status:
          type: string
          enum: [healthy, degraded, unhealthy]
        message:
          type: string
        last_check:
          type: string
          format: date-time

    # Authentication schemas
    RegisterRequest:
      type: object
      required:
        - email
        - password
        - name
      properties:
        email:
          type: string
          format: email
        password:
          type: string
          minLength: 8
        name:
          type: string
          minLength: 2

    LoginRequest:
      type: object
      required:
        - email
        - password
      properties:
        email:
          type: string
          format: email
        password:
          type: string

    RefreshRequest:
      type: object
      required:
        - refresh_token
      properties:
        refresh_token:
          type: string

    AuthResponse:
      type: object
      properties:
        access_token:
          type: string
        refresh_token:
          type: string
        token_type:
          type: string
          default: Bearer
        expires_in:
          type: integer
          description: Token expiration time in seconds
        user:
          $ref: '#/components/schemas/User'

    User:
      type: object
      properties:
        id:
          type: string
          format: uuid
        email:
          type: string
          format: email
        name:
          type: string
        created_at:
          type: string
          format: date-time

    # API Key schemas
    CreateApiKeyRequest:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: Descriptive name for the API key
        expires_at:
          type: string
          format: date-time
          description: Optional expiration date

    ApiKey:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        created_at:
          type: string
          format: date-time
        last_used_at:
          type: string
          format: date-time
        expires_at:
          type: string
          format: date-time

    ApiKeyResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
        key:
          type: string
          description: The actual API key (only shown once)
        name:
          type: string
        expires_at:
          type: string
          format: date-time

    # Zero-Knowledge Compression schemas
    CompressionRequest:
      type: object
      required:
        - data
      properties:
        data:
          type: string
          format: base64
          description: Base64 encoded data to compress
        privacy_level:
          type: string
          enum: [public, private, confidential, top_secret]
          default: private
          description: Privacy level for zero-knowledge proof

    CompressionResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for compressed data
        compressed_data:
          type: string
          format: base64
          description: Base64 encoded compressed data
        original_size:
          type: integer
          description: Original data size in bytes
        compressed_size:
          type: integer
          description: Compressed data size in bytes
        compression_ratio:
          type: number
          description: Compression ratio (0.0 - 1.0)
        privacy_level:
          type: string
          enum: [public, private, confidential, top_secret]
        proof:
          type: object
          description: Zero-knowledge proof metadata

    DecompressionRequest:
      type: object
      required:
        - compressed_data
      properties:
        compressed_data:
          type: object
          description: Compressed data object from compression response
        verify_proof:
          type: boolean
          default: true
          description: Whether to verify zero-knowledge proof

    DecompressionResponse:
      type: object
      properties:
        data:
          type: string
          format: base64
          description: Base64 encoded decompressed data
        verified:
          type: boolean
          description: Whether zero-knowledge proof was verified
        original_size:
          type: integer

    HomomorphicAddRequest:
      type: object
      required:
        - value1
        - value2
      properties:
        value1:
          type: object
          description: First compressed value
        value2:
          type: object
          description: Second compressed value

    HomomorphicAddResponse:
      type: object
      properties:
        result:
          type: object
          description: Compressed result of addition
        proof:
          type: object
          description: Proof of correct homomorphic operation

    CompressionStats:
      type: object
      properties:
        total_compressions:
          type: integer
        total_decompressions:
          type: integer
        total_homomorphic_ops:
          type: integer
        avg_compression_ratio:
          type: number
        total_bytes_saved:
          type: integer
        privacy_level_distribution:
          type: object
          additionalProperties:
            type: integer

    # Neural Topology schemas
    NeuralEvolutionRequest:
      type: object
      properties:
        evolution_params:
          type: object
          properties:
            mutation_rate:
              type: number
              default: 0.1
            crossover_rate:
              type: number
              default: 0.7
            selection_pressure:
              type: number
              default: 2.0
        performance_targets:
          type: object
          properties:
            min_accuracy:
              type: number
            max_latency_ms:
              type: integer
            max_memory_mb:
              type: integer

    NeuralEvolutionResponse:
      type: object
      properties:
        evolution_id:
          type: string
        generation:
          type: integer
        fitness_score:
          type: number
        topology_changes:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                enum: [add_layer, remove_layer, modify_connections]
              details:
                type: object

    NeuralTransformRequest:
      type: object
      required:
        - input_data
      properties:
        input_data:
          type: array
          items:
            type: number
        use_quantum_pathways:
          type: boolean
          default: true

    NeuralTransformResponse:
      type: object
      properties:
        output:
          type: array
          items:
            type: number
        computation_time_ms:
          type: number
        pathways_used:
          type: integer
        quantum_efficiency:
          type: number

    NeuralTopologyInfo:
      type: object
      properties:
        generation:
          type: integer
        layers:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              type:
                type: string
              neurons:
                type: integer
              activation:
                type: string
        connections:
          type: integer
        parameters:
          type: integer
        fitness_score:
          type: number
        quantum_pathways:
          type: integer

    # Quantum Prediction schemas
    QuantumPredictionRequest:
      type: object
      required:
        - input_state
        - prediction_horizon
      properties:
        input_state:
          type: object
          description: Initial quantum state vector
        prediction_horizon:
          type: integer
          description: Number of time steps to predict
        confidence_threshold:
          type: number
          default: 0.8
        use_entanglement:
          type: boolean
          default: true

    QuantumPredictionResponse:
      type: object
      properties:
        predictions:
          type: array
          items:
            type: object
            properties:
              timestamp:
                type: string
                format: date-time
              state:
                type: object
              probability:
                type: number
              confidence:
                type: number
        quantum_fidelity:
          type: number
        decoherence_factor:
          type: number
        entanglement_score:
          type: number

    QuantumEntangleRequest:
      type: object
      required:
        - streams
      properties:
        streams:
          type: array
          minItems: 2
          items:
            type: object
            properties:
              id:
                type: string
              data:
                type: object
        entanglement_type:
          type: string
          enum: [bell, ghz, cluster]
          default: bell

    QuantumEntangleResponse:
      type: object
      properties:
        entanglement_id:
          type: string
        entangled_streams:
          type: array
          items:
            type: string
        entanglement_strength:
          type: number
        correlation_matrix:
          type: array
          items:
            type: array
            items:
              type: number

    QuantumStateInfo:
      type: object
      properties:
        qubits:
          type: integer
        superposition_states:
          type: integer
        entangled_pairs:
          type: integer
        coherence_time_ms:
          type: number
        fidelity:
          type: number
        temperature_mk:
          type: number
          description: Temperature in millikelvin

    # AGI Infrastructure schemas
    ConsciousnessState:
      type: object
      properties:
        awareness_level:
          type: number
          description: Current awareness level (0.0 - 1.0)
        attention_focus:
          type: array
          items:
            type: object
            properties:
              target:
                type: string
              intensity:
                type: number
        memory_integration:
          type: number
        self_model_coherence:
          type: number
        emergence_indicators:
          type: object
          properties:
            pattern_recognition:
              type: number
            abstraction_capability:
              type: number
            creativity_index:
              type: number

    KnowledgeQueryRequest:
      type: object
      required:
        - query
      properties:
        query:
          type: string
          description: Semantic query in natural language
        context:
          type: array
          items:
            type: string
        max_results:
          type: integer
          default: 10
        include_reasoning:
          type: boolean
          default: true

    KnowledgeQueryResponse:
      type: object
      properties:
        results:
          type: array
          items:
            type: object
            properties:
              concept:
                type: string
              relevance:
                type: number
              connections:
                type: array
                items:
                  type: string
              reasoning:
                type: string
        query_understanding:
          type: object
          properties:
            intent:
              type: string
            entities:
              type: array
              items:
                type: string
            confidence:
              type: number

    MetaCognitiveRequest:
      type: object
      required:
        - thought_stream
      properties:
        thought_stream:
          type: array
          items:
            type: object
            properties:
              thought:
                type: string
              timestamp:
                type: string
                format: date-time
        analysis_depth:
          type: string
          enum: [shallow, medium, deep]
          default: medium

    MetaCognitiveResponse:
      type: object
      properties:
        patterns:
          type: array
          items:
            type: object
            properties:
              pattern_type:
                type: string
              frequency:
                type: integer
              significance:
                type: number
        cognitive_biases:
          type: array
          items:
            type: object
            properties:
              bias_type:
                type: string
              strength:
                type: number
              mitigation:
                type: string
        self_improvement_suggestions:
          type: array
          items:
            type: string
        meta_level:
          type: integer
          description: Depth of meta-cognitive recursion

    # Context Extraction schemas
    ContextExtractionRequest:
      type: object
      required:
        - content
      properties:
        content:
          type: string
          description: Content to extract context from
        levels:
          type: array
          items:
            type: integer
            minimum: 1
            maximum: 7
          description: Which context levels to extract (1-7)
        include_crown_jewels:
          type: boolean
          default: true
          description: Include crown jewels analysis

    ContextExtractionResponse:
      type: object
      properties:
        contexts:
          type: object
          properties:
            level1_immediate:
              $ref: '#/components/schemas/ImmediateContext'
            level2_component:
              $ref: '#/components/schemas/ComponentContext'
            level3_system:
              $ref: '#/components/schemas/SystemContext'
            level4_constraints:
              $ref: '#/components/schemas/ConstraintContext'
            level5_quality:
              $ref: '#/components/schemas/QualityContext'
            level6_business:
              $ref: '#/components/schemas/BusinessContext'
            level7_evolution:
              $ref: '#/components/schemas/EvolutionContext'
        crown_jewels:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
              value:
                type: string
              confidence:
                type: number
        processing_time_ms:
          type: number

    ImmediateContext:
      type: object
      properties:
        entities:
          type: array
          items:
            type: string
        actions:
          type: array
          items:
            type: string
        temporal_markers:
          type: array
          items:
            type: string

    ComponentContext:
      type: object
      properties:
        components:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              type:
                type: string
              relationships:
                type: array
                items:
                  type: string

    SystemContext:
      type: object
      properties:
        system_boundaries:
          type: array
          items:
            type: string
        external_systems:
          type: array
          items:
            type: string
        integration_points:
          type: array
          items:
            type: string

    ConstraintContext:
      type: object
      properties:
        technical_constraints:
          type: array
          items:
            type: string
        resource_constraints:
          type: array
          items:
            type: string
        regulatory_constraints:
          type: array
          items:
            type: string

    QualityContext:
      type: object
      properties:
        quality_attributes:
          type: array
          items:
            type: object
            properties:
              attribute:
                type: string
              importance:
                type: string
                enum: [critical, high, medium, low]
              current_state:
                type: string

    BusinessContext:
      type: object
      properties:
        business_goals:
          type: array
          items:
            type: string
        stakeholders:
          type: array
          items:
            type: string
        value_streams:
          type: array
          items:
            type: string

    EvolutionContext:
      type: object
      properties:
        evolution_stage:
          type: string
        growth_potential:
          type: number
        transformation_opportunities:
          type: array
          items:
            type: string
        future_state_vision:
          type: string

    ContextInfo:
      type: object
      properties:
        version:
          type: string
        supported_levels:
          type: array
          items:
            type: object
            properties:
              level:
                type: integer
              name:
                type: string
              description:
                type: string
        capabilities:
          type: array
          items:
            type: string

    # Analytics schemas
    AnalyticsOverview:
      type: object
      properties:
        period:
          type: object
          properties:
            start:
              type: string
              format: date-time
            end:
              type: string
              format: date-time
        summary:
          type: object
          properties:
            total_requests:
              type: integer
            unique_users:
              type: integer
            total_tickets:
              type: integer
            avg_response_time_ms:
              type: number
            compression_savings_gb:
              type: number
            quantum_predictions_made:
              type: integer
            neural_evolutions:
              type: integer
        performance:
          type: object
          properties:
            uptime_percentage:
              type: number
            cache_hit_rate:
              type: number
            quantum_cache_efficiency:
              type: number
        ai_metrics:
          type: object
          properties:
            consciousness_emergence_score:
              type: number
            knowledge_graph_nodes:
              type: integer
            meta_cognitive_depth:
              type: integer

    TicketAnalytics:
      type: object
      properties:
        total_tickets:
          type: integer
        by_status:
          type: object
          additionalProperties:
            type: integer
        by_priority:
          type: object
          additionalProperties:
            type: integer
        resolution_time:
          type: object
          properties:
            avg_hours:
              type: number
            median_hours:
              type: number
            p95_hours:
              type: number
        time_series:
          type: array
          items:
            type: object
            properties:
              timestamp:
                type: string
                format: date-time
              count:
                type: integer
              avg_resolution_hours:
                type: number