<?php
/**
 * Timeline Planner Module — Route Definitions
 *
 * Registers Couple Portal timeline checklists, tasks, calendar month grids,
 * and milestones endpoints. Loaded within routes/couple.php.
 *
 * Available variable: $router (App\Core\Router instance)
 *
 * @package Inveetaire
 * @ref     RC-018
 */

$router->group('/timeline', function ($router) {
    // Dashboard summary
    $router->get('', 'App\\Modules\\Timeline\\TimelineController@index');
    
    // Tasks list & timeline view
    $router->get('/tasks', 'App\\Modules\\Timeline\\TimelineController@tasks');
    $router->get('/tasks/create', 'App\\Modules\\Timeline\\TimelineController@createTask');
    $router->post('/tasks/create', 'App\\Modules\\Timeline\\TimelineController@storeTask', [
        'App\\Middleware\\CsrfMiddleware'
    ]);
    $router->get('/tasks/edit/{id}', 'App\\Modules\\Timeline\\TimelineController@editTask');
    $router->post('/tasks/edit/{id}', 'App\\Modules\\Timeline\\TimelineController@updateTask', [
        'App\\Middleware\\CsrfMiddleware'
    ]);
    $router->post('/tasks/delete/{id}', 'App\\Modules\\Timeline\\TimelineController@deleteTask', [
        'App\\Middleware\\CsrfMiddleware'
    ]);
    $router->post('/tasks/toggle-status/{id}', 'App\\Modules\\Timeline\\TimelineController@toggleStatus', [
        'App\\Middleware\\CsrfMiddleware'
    ]);

    // Calendar view
    $router->get('/calendar', 'App\\Modules\\Timeline\\TimelineController@calendar');

    // Milestones CRUD
    $router->get('/milestones', 'App\\Modules\\Timeline\\TimelineController@milestones');
    $router->post('/milestones/create', 'App\\Modules\\Timeline\\TimelineController@createMilestone', [
        'App\\Middleware\\CsrfMiddleware'
    ]);
    $router->post('/milestones/edit/{id}', 'App\\Modules\\Timeline\\TimelineController@updateMilestone', [
        'App\\Middleware\\CsrfMiddleware'
    ]);
    $router->post('/milestones/delete/{id}', 'App\\Modules\\Timeline\\TimelineController@deleteMilestone', [
        'App\\Middleware\\CsrfMiddleware'
    ]);
    $router->post('/milestones/toggle-complete/{id}', 'App\\Modules\\Timeline\\TimelineController@toggleMilestoneComplete', [
        'App\\Middleware\\CsrfMiddleware'
    ]);
});
