<?php

declare(strict_types=1);

use App\Controllers\AuthController;
use App\Controllers\ExportController;
use App\Controllers\HomeController;
use App\Controllers\HouseholdController;
use App\Controllers\HouseholderNameController;
use App\Controllers\TerritoryController;

// Home
$router->get('/', [HomeController::class, 'index']);
$router->get('/users/{id}', [HomeController::class, 'user']);

// Auth
$router->get('/login', [AuthController::class, 'showLogin']);
$router->post('/login', [AuthController::class, 'login']);
$router->post('/logout', [AuthController::class, 'logout']);

// Territories — specific routes before parameterized
$router->get('/territories',             [TerritoryController::class, 'index']);
$router->get('/territories/new',         [TerritoryController::class, 'create']);
$router->post('/territories',            [TerritoryController::class, 'store']);
$router->get('/territories/{id}',        [TerritoryController::class, 'show']);
$router->get('/territories/{id}/edit',   [TerritoryController::class, 'edit']);
$router->post('/territories/{id}',       [TerritoryController::class, 'update']);
$router->post('/territories/{id}/delete', [TerritoryController::class, 'delete']);

// Households
$router->get('/households',              [HouseholdController::class, 'index']);
$router->get('/households/new',          [HouseholdController::class, 'create']);
$router->post('/households',             [HouseholdController::class, 'store']);
$router->get('/households/{id}',         [HouseholdController::class, 'show']);
$router->get('/households/{id}/edit',    [HouseholdController::class, 'edit']);
$router->post('/households/{id}',        [HouseholdController::class, 'update']);
$router->post('/households/{id}/delete', [HouseholdController::class, 'delete']);

// Householder Names
$router->get('/householder-names',                         [HouseholderNameController::class, 'index']);
$router->get('/householder-names/new',                     [HouseholderNameController::class, 'create']);
$router->post('/householder-names',                        [HouseholderNameController::class, 'store']);
$router->get('/householder-names/{id}',                    [HouseholderNameController::class, 'show']);
$router->get('/householder-names/{id}/edit',               [HouseholderNameController::class, 'edit']);
$router->post('/householder-names/{id}',                   [HouseholderNameController::class, 'update']);
$router->post('/householder-names/{id}/delete',            [HouseholderNameController::class, 'delete']);
$router->post('/householder-names/{id}/mark-returned',     [HouseholderNameController::class, 'markReturned']);

// Export
$router->get('/export',  [ExportController::class, 'generate']);
$router->post('/export', [ExportController::class, 'download']);
