<?php

/**
 * Developer Console Routes
 *
 * All routes require:
 *   - AuthMiddleware (valid session)
 *   - RoleMiddleware (super_admin role)
 *   - DeveloperMiddleware (DEVELOPER_MODE=true guard)
 *
 * Route Prefix: /app/developer
 *
 * DX001 Routes:
 *   GET  /app/developer                → DeveloperController@index
 *   GET  /app/developer/database       → DeveloperController@database
 *   GET  /app/developer/schema         → DeveloperController@schema
 *
 * DX002A Routes:
 *   GET  /app/developer/supabase       → DeveloperController@supabase
 *   GET  /app/developer/inspector      → DeveloperController@inspector
 *   GET  /app/developer/mapping        → DeveloperController@mappingDoc
 *   POST /app/developer/supabase/test  → DeveloperController@testSupabaseConnection
 *
 * DX002B Routes:
 *   GET  /app/developer/sync           → DeveloperController@sync
 *   GET  /app/developer/sync/log       → DeveloperController@syncLog
 *   POST /app/developer/sync/compare   → DeveloperController@syncCompare
 *   POST /app/developer/sync/dry-run   → DeveloperController@syncDryRun
 *   POST /app/developer/sync/push      → DeveloperController@syncPush
 *   POST /app/developer/sync/verify    → DeveloperController@syncVerify
 *   POST /app/developer/sync/preview   → DeveloperController@syncPreview
 *   POST /app/developer/sync/log/clear → DeveloperController@syncLogClear
 *
 * DX003 Routes:
 *   GET  /app/developer/health         → DeveloperController@health
 *   GET  /app/developer/info           → DeveloperController@info
 *   GET  /app/developer/logs           → DeveloperController@logs
 *   POST /app/developer/logs/clear     → DeveloperController@logClear
 *   GET  /app/developer/logs/download  → DeveloperController@logDownload
 *
 * @package Inveetaire
 * @ref     DX001, DX002A, DX002B, DX003
 */

$router->group('/app/developer', function ($router) {

    // ── DX001 — Core Console ─────────────────────────────────────────────────
    $router->get('',  'App\\Modules\\Developer\\DeveloperController@index');
    $router->get('/', 'App\\Modules\\Developer\\DeveloperController@index');
    $router->get('/database', 'App\\Modules\\Developer\\DeveloperController@database');
    $router->get('/schema',   'App\\Modules\\Developer\\DeveloperController@schema');

    // ── DX002A — Supabase Inspector ──────────────────────────────────────────
    $router->get('/supabase',       'App\\Modules\\Developer\\DeveloperController@supabase');
    $router->post('/supabase/test', 'App\\Modules\\Developer\\DeveloperController@testSupabaseConnection');
    $router->get('/inspector',      'App\\Modules\\Developer\\DeveloperController@inspector');
    $router->get('/mapping',        'App\\Modules\\Developer\\DeveloperController@mappingDoc');

    // ── DX002B — Synchronization ─────────────────────────────────────────────
    $router->get('/sync',              'App\\Modules\\Developer\\DeveloperController@sync');
    $router->get('/sync/log',          'App\\Modules\\Developer\\DeveloperController@syncLog');
    $router->post('/sync/compare',     'App\\Modules\\Developer\\DeveloperController@syncCompare');
    $router->post('/sync/dry-run',     'App\\Modules\\Developer\\DeveloperController@syncDryRun');
    $router->post('/sync/push',        'App\\Modules\\Developer\\DeveloperController@syncPush');
    $router->post('/sync/verify',      'App\\Modules\\Developer\\DeveloperController@syncVerify');
    $router->post('/sync/preview',     'App\\Modules\\Developer\\DeveloperController@syncPreview');
    $router->post('/sync/log/clear',   'App\\Modules\\Developer\\DeveloperController@syncLogClear');

    // ── DX003 — System Health, Information & Log Center ─────────────────────
    $router->get('/health',            'App\\Modules\\Developer\\DeveloperController@health');
    $router->get('/info',              'App\\Modules\\Developer\\DeveloperController@info');
    $router->get('/logs',              'App\\Modules\\Developer\\DeveloperController@logs');
    $router->post('/logs/clear',       'App\\Modules\\Developer\\DeveloperController@logClear');
    $router->get('/logs/download',     'App\\Modules\\Developer\\DeveloperController@logDownload');

}, [
    'App\Middleware\AuthMiddleware',
    'App\Middleware\RoleMiddleware',
    'App\Middleware\DeveloperMiddleware',
]);
