<?php

return [

    /*
    |--------------------------------------------------------------------------
    | External API Configuration
    |--------------------------------------------------------------------------
    |
    | This file contains all the API endpoints and configuration for external
    | services. This centralized approach makes it easy to manage and update
    | API endpoints without modifying multiple files.
    |
    */

    /*
    |--------------------------------------------------------------------------
    | Base Configuration
    |--------------------------------------------------------------------------
    */
    'base_url' => env('SISCON_API_URL', 'http://localhost:8000/api/v1'),
    'timeout' => (int) env('SISCON_API_TIMEOUT', 30),
    'retries' => (int) env('SISCON_API_RETRIES', 3),
    'retry_delay' => (int) env('SISCON_API_RETRY_DELAY', 1000), // milliseconds

    /*
    |--------------------------------------------------------------------------
    | Authentication Endpoints
    |--------------------------------------------------------------------------
    */
    'auth' => [
        'login' => '/backoffice/auth/login',
        'logout' => '/backoffice/auth/logout',
        'refresh' => '/backoffice/auth/refresh',
        'verify' => '/backoffice/auth/validate-token',
        'user' => '/backoffice/auth/user',
        'change_password' => '/backoffice/auth/change-password',
    ],

    /*
    |--------------------------------------------------------------------------
    | Business Management Endpoints
    |--------------------------------------------------------------------------
    */
    'business' => [
        'create_user' => '/business/new-business-user',
        'list_users' => '/business/users',
        'get_user' => '/business/users/{id}',
        'update_user' => '/business/users/{id}',
        'delete_user' => '/business/users/{id}',
        'activate_user' => '/business/users/{id}/activate',
        'deactivate_user' => '/business/users/{id}/deactivate',
    ],

    /*
    |--------------------------------------------------------------------------
    | Access Request Endpoints
    |--------------------------------------------------------------------------
    */
    'access_requests' => [
        'list' => '/access-requests',
        'show' => '/access-requests/{id}',
        'approve' => '/access-requests/{id}/approve',
        'reject' => '/access-requests/{id}/reject',
        'regenerate_first_token' => '/backoffice/regenerate-first-token',
        'update_status' => '/access-requests/{id}/status',
        'stats' => '/access-requests/stats',
    ],

    /*
    |--------------------------------------------------------------------------
    | Company Management Endpoints
    |--------------------------------------------------------------------------
    */
    'companies' => [
        'list' => '/backoffice/companies-list',
        'show' => '/backoffice/companies/{id}',
        'create' => '/backoffice/companies',
        'update' => '/backoffice/companies/{id}',
        'delete' => '/backoffice/companies/{id}',
        'activate' => '/backoffice/companies/{id}/activate',
        'deactivate' => '/backoffice/companies/{id}/deactivate',
    ],

    /*
    |--------------------------------------------------------------------------
    | Plan Management Endpoints
    |--------------------------------------------------------------------------
    */
    'plans' => [
        'list' => '/plans',
        'show' => '/plans/{id}',
        'assign' => '/plans/assign',
        'upgrade' => '/plans/upgrade',
        'downgrade' => '/plans/downgrade',
    ],

    /*
    |--------------------------------------------------------------------------
    | Commercial Advisors Endpoints
    |--------------------------------------------------------------------------
    */
    'commercial_advisors' => [
        'list' => '/backoffice/commercial-advisors',
        'show' => '/backoffice/commercial-advisors/{id}',
        'create' => '/backoffice/commercial-advisors',
        'update' => '/backoffice/commercial-advisors/{id}',
        'delete' => '/backoffice/commercial-advisors/{id}',
        'change_status' => '/backoffice/commercial-advisors/{id}/status',
        'export' => '/backoffice/commercial-advisors/export',
    ],

    /*
    |--------------------------------------------------------------------------
    | System Endpoints
    |--------------------------------------------------------------------------
    */
    'system' => [
        'health' => '/health',
        'status' => '/status',
        'version' => '/version',
    ],

    /*
    |--------------------------------------------------------------------------
    | Reporting Endpoints
    |--------------------------------------------------------------------------
    */
    'reports' => [
        'dashboard' => '/reports/dashboard',
        'users' => '/reports/users',
        'companies' => '/reports/companies',
        'financial' => '/reports/financial',
        'activity' => '/reports/activity',
    ],

    /*
    |--------------------------------------------------------------------------
    | Default Headers
    |--------------------------------------------------------------------------
    */
    'headers' => [
        'Content-Type' => 'application/json',
        'Accept' => 'application/json',
        'User-Agent' => 'SISCON-Backoffice/1.0',
        'Authorization' => 'Bearer ' . env('SISCON_API_TOKEN', ''),
    ],

    /*
    |--------------------------------------------------------------------------
    | Error Handling
    |--------------------------------------------------------------------------
    */
    'error_handling' => [
        'log_requests' => env('API_LOG_REQUESTS', true),
        'log_responses' => env('API_LOG_RESPONSES', true),
        'log_errors' => env('API_LOG_ERRORS', true),
        'throw_exceptions' => env('API_THROW_EXCEPTIONS', false),
    ],

];