# Solace AI Connector Example: REST API Gateway Configuration
#
# This file demonstrates how to configure the REST API Gateway application.
# It uses the custom RestGatewayApp class defined in src.solace_agent_mesh.gateway.rest.app.
#
# Required Environment Variables:
# - NAMESPACE: The A2A topic namespace (e.g., "myorg/dev").
# - SOLACE_BROKER_URL: URL of the Solace broker for the A2A control plane.
# - SOLACE_BROKER_USERNAME: Username for the Solace broker.
# - SOLACE_BROKER_PASSWORD: Password for the Solace broker.
# - SOLACE_BROKER_VPN: VPN name for the Solace broker.
# - ARTIFACT_BASE_PATH: Base path for the filesystem artifact service (e.g., "/tmp/a2a_artifacts").
# - EXTERNAL_AUTH_SERVICE_URL: URL of the external authentication service (if enforce_authentication is true).
#
# Optional Environment Variables:
# - REST_API_HOST: Host for the REST API server (defaults to 0.0.0.0).
# - REST_API_PORT: Port for the REST API server (defaults to 8080).
# - ROLE_DEFINITIONS_PATH: Path to RBAC role definitions YAML.
# - USER_ASSIGNMENTS_PATH: Path to RBAC user assignments YAML.

log:
  stdout_log_level: INFO
  log_file_level: DEBUG
  log_file: rest_gateway.log

# Include shared configuration for the Solace broker connection (A2A Control Plane)
!include shared_config.yaml

apps:
  - name: rest_gateway_app # A unique name for this SAC application instance
    app_base_path: . # Assumes running from the project root where src/ is located
    app_module: src.solace_agent_mesh.gateway.rest.app # Use the custom App class for the REST Gateway

    # Broker settings for the A2A Control Plane
    broker:
      <<: *broker_connection
      # Queue name and subscriptions are automatically generated by BaseGatewayApp

    # App Level Config - Validated by RestGatewayApp.app_schema
    app_config:
      # --- Base Gateway Configuration (from BaseGatewayApp) ---
      namespace: ${NAMESPACE, myorg/dev}
      gateway_id: ${REST_GATEWAY_ID, rest-gateway-01} # Optional: Auto-generated if omitted

      # --- Artifact Service (Required for file uploads/downloads) ---
      # Scope 'namespace' allows artifacts to be shared with other components
      # (like ADK Hosts) configured with the same namespace and base_path.
      artifact_service:
        type: "filesystem"
        base_path: ${ARTIFACT_BASE_PATH, /tmp/a2a_rest_artifacts}
        artifact_scope: "namespace"

      # --- Identity Service (Optional, for enriching user profiles) ---
      # identity_service:
      #   type: "local_file"
      #   file_path: "config/users.json" # Example path

      # --- Authorization Service (Optional, for RBAC on agents) ---
      authorization_service:
        type: "default_rbac"
        role_definitions_path: ${ROLE_DEFINITIONS_PATH, examples/auth/dev-roles.yaml}
        user_assignments_path: ${USER_ASSIGNMENTS_PATH, examples/auth/dev-users.yaml}

      # --- REST Gateway Specific Configuration ---
      rest_api_server_host: ${REST_API_HOST, 0.0.0.0}
      rest_api_server_port: ${REST_API_PORT, 8080}
      rest_api_https_port: ${REST_API_HTTPS_PORT, 1943}
      ssl_keyfile: ${SSL_KEYFILE}
      ssl_certfile: ${SSL_CERTFILE}
      ssl_keyfile_password: ${SSL_KEYFILE_PASSWORD}
      sync_mode_timeout_seconds: 300 # Timeout for the legacy v1 synchronous API

      # --- Authentication Configuration ---
      enforce_authentication: false # Set to false to disable auth checks
      external_auth_service_url: ${EXTERNAL_AUTH_SERVICE_URL, http://localhost:8080}

      # --- Development User Identity (used when enforce_authentication is false) ---
      default_user_identity: "sam_dev_user"
