<?php

declare(strict_types=1);

return [
    // Side effects remain disabled unless a separately reviewed rollout explicitly changes this value.
    'enabled' => false,
    'adapter_enabled' => false,
    'cutover_interlock_enabled' => false,
    'authority_state_path' => 'var/runtime/crm-authority/authority-state.json',
    'authority_health_state_path' => 'var/runtime/crm-authority/health-state.json',
    'authority_state_max_age_seconds' => 300,
    'authority_health_lease_seconds' => 15,
    'authority_health_refresh_seconds' => 5,
    'authority_action_pin_ttl_seconds' => 30,
    'authority' => [
        'default' => 'LEGACY',
        'rules' => [
            // No CEM-owned scope is configured in the safe sample.
            // A Phase 9C2.2 pilot rule must explicitly contain execution_scope,
            // legacy_suppression_scope, and a reviewed DEDICATED_EXTENSION_TO_EXECUTION_QUEUE constraint.
        ],
    ],
    'consumer_name' => 'crm-production-foundation',
    'consumer_version' => '0.9.0',
    'tenant_scope' => 'CHANGE_ME_TENANT',
    'environment_scope' => 'DEV',
    'allowed_directions' => ['inbound'],
    'activity_event' => 'communication.call.ended',
    'recording_enabled' => true,
    'caller_identity_required' => false,
    'popup_ring_enabled' => false,
    'popup_answered_enabled' => true,
    'popup_adapter' => [
        'type' => 'disabled',
        'enabled' => false,
        'host' => '127.0.0.1',
        'port' => 8081,
        'connect_timeout_ms' => 1000,
        'write_timeout_ms' => 1000,
    ],
    'idempotency_path' => 'var/runtime/crm-production/idempotency.json',
    'action_audit_path' => 'var/runtime/crm-production/actions.jsonl',
    'authority_audit_path' => 'var/runtime/crm-production/authority.jsonl',
    // "static" is the safe default. "vtiger-readonly" requires explicit enablement below.
    'crm_registry_mode' => 'static',
    'vtiger_readonly' => [
        'enabled' => false,
        'db_host' => 'localhost',
        'db_port' => 3306,
        'db_name' => 'CHANGE_ME_DATABASE',
        'db_user' => 'CHANGE_ME_READ_ONLY_USER',
        'db_password_file' => 'config/crm_vtiger_readonly.password.local',
        'connect_timeout' => 3,
        'query_timeout' => 5,
        'allowed_roles' => [],
        'extension_field' => 'phone_crm_extension',
        'registry_ttl_seconds' => 300,
        'stale_ttl_seconds' => 900,
        'contact_cache_ttl_seconds' => 300,
    ],
    'crm_extensions' => [
        '1000' => ['enabled' => true, 'crm_user_ref' => 'safe-user-ref'],
    ],
    'queues' => [
        'support' => [
            'enabled' => true,
            'allowed_extensions' => ['1000'],
            'tenant_id' => 'CHANGE_ME_TENANT',
            'environment' => 'DEV',
        ],
    ],
];
