<?php
/**
 * Web Routes - Zabibu Residence
 */

// ==================== PUBLIC / LANDING ====================
$router->get('/', 'LandingController@index', 'home');
$router->get('/about', 'LandingController@about', 'about');
$router->get('/residences', 'LandingController@residences', 'residences');
$router->get('/residences/{id}', 'LandingController@show', 'residences.show');
$router->get('/search', 'LandingController@search', 'search');
$router->get('/contact', 'LandingController@contact', 'contact');
$router->post('/contact', 'LandingController@sendContact');
$router->post('/newsletter', 'LandingController@newsletter', 'newsletter');

// ==================== AUTH ====================
$router->get('/login', 'AuthController@loginForm', 'login');
$router->post('/login', 'AuthController@login');
$router->get('/register', 'AuthController@registerForm', 'register');
$router->post('/register', 'AuthController@register');
$router->get('/logout', 'AuthController@logout', 'logout');
$router->get('/verify-email/{token}', 'AuthController@verifyEmail', 'verify.email');
$router->get('/resend-verification', 'AuthController@resendVerificationForm', 'resend.verification');
$router->post('/resend-verification', 'AuthController@resendVerification');
$router->get('/forgot-password', 'AuthController@forgotForm', 'forgot');
$router->post('/forgot-password', 'AuthController@forgot');
$router->get('/reset-password/{token}', 'AuthController@resetForm', 'reset');
$router->post('/reset-password', 'AuthController@reset');

// ==================== BOOKING (Public) ====================
$router->get('/book/{id}', 'BookingController@form', 'booking.form');
$router->post('/book', 'BookingController@store', 'booking.store');
$router->get('/booking/confirm/{ref}', 'BookingController@confirm', 'booking.confirm');

// ==================== TENANT PORTAL ====================
$router->get('/tenant', 'TenantPortalController@dashboard', 'tenant.dashboard');
$router->get('/tenant/payments', 'TenantPortalController@payments', 'tenant.payments');
$router->get('/tenant/maintenance', 'TenantPortalController@maintenance', 'tenant.maintenance');
$router->post('/tenant/maintenance', 'TenantPortalController@storeRequest');
$router->get('/tenant/profile', 'TenantPortalController@profile', 'tenant.profile');
$router->post('/tenant/profile', 'TenantPortalController@updateProfile');
$router->get('/tenant/receipt/{id}', 'TenantPortalController@downloadReceipt', 'tenant.receipt');

// ==================== ADMIN ====================
$router->get('/admin', 'AdminController@dashboard', 'admin.dashboard');

// Properties
$router->get('/admin/properties', 'PropertyController@index', 'admin.properties');
$router->get('/admin/properties/create', 'PropertyController@create', 'admin.properties.create');
$router->post('/admin/properties', 'PropertyController@store');
$router->get('/admin/properties/{id}', 'PropertyController@show', 'admin.properties.show');
$router->get('/admin/properties/{id}/edit', 'PropertyController@edit', 'admin.properties.edit');
$router->post('/admin/properties/{id}', 'PropertyController@update');
$router->post('/admin/properties/{id}/delete', 'PropertyController@destroy');

// Buildings / Units
$router->get('/admin/buildings', 'BuildingController@index', 'admin.buildings');
$router->post('/admin/buildings', 'BuildingController@store');
$router->get('/admin/buildings/{id}/edit', 'BuildingController@edit');
$router->post('/admin/buildings/{id}', 'BuildingController@update');
$router->post('/admin/buildings/{id}/delete', 'BuildingController@destroy');

$router->get('/admin/units', 'UnitController@index', 'admin.units');
$router->post('/admin/units', 'UnitController@store');
$router->get('/admin/units/{id}/edit', 'UnitController@edit');
$router->post('/admin/units/{id}', 'UnitController@update');
$router->post('/admin/units/{id}/delete', 'UnitController@destroy');

// Tenants
$router->get('/admin/tenants', 'TenantController@index', 'admin.tenants');
$router->get('/admin/tenants/create', 'TenantController@create', 'admin.tenants.create');
$router->post('/admin/tenants', 'TenantController@store');
$router->get('/admin/tenants/{id}', 'TenantController@show', 'admin.tenants.show');
$router->get('/admin/tenants/{id}/edit', 'TenantController@edit');
$router->post('/admin/tenants/{id}', 'TenantController@update');
$router->post('/admin/tenants/{id}/delete', 'TenantController@destroy');

// Leases
$router->get('/admin/leases', 'LeaseController@index', 'admin.leases');
$router->get('/admin/leases/create', 'LeaseController@create');
$router->post('/admin/leases', 'LeaseController@store');
$router->get('/admin/leases/{id}', 'LeaseController@show');
$router->get('/admin/leases/{id}/edit', 'LeaseController@edit');
$router->post('/admin/leases/{id}', 'LeaseController@update');
$router->post('/admin/leases/{id}/delete', 'LeaseController@destroy');
$router->get('/admin/leases/{id}/pdf', 'LeaseController@pdf');

// Bookings
$router->get('/admin/bookings', 'BookingController@index', 'admin.bookings');
$router->get('/admin/bookings/{id}', 'BookingController@show');
$router->post('/admin/bookings/{id}/status', 'BookingController@updateStatus');

// Payments
$router->get('/admin/payments', 'PaymentController@index', 'admin.payments');
$router->get('/admin/payments/create', 'PaymentController@create');
$router->post('/admin/payments', 'PaymentController@store');
$router->get('/admin/payments/{id}', 'PaymentController@show');
$router->get('/admin/payments/{id}/receipt', 'PaymentController@receipt');
$router->get('/admin/invoices', 'InvoiceController@index', 'admin.invoices');
$router->post('/admin/invoices/generate', 'InvoiceController@generate');
$router->get('/admin/invoices/{id}/pdf', 'InvoiceController@pdf');

// Expenses
$router->get('/admin/expenses', 'ExpenseController@index', 'admin.expenses');
$router->post('/admin/expenses', 'ExpenseController@store');
$router->post('/admin/expenses/{id}', 'ExpenseController@update');
$router->post('/admin/expenses/{id}/delete', 'ExpenseController@destroy');

// Maintenance
$router->get('/admin/maintenance', 'MaintenanceController@index', 'admin.maintenance');
$router->get('/admin/maintenance/{id}', 'MaintenanceController@show');
$router->post('/admin/maintenance/{id}/update', 'MaintenanceController@update');

// Reports
$router->get('/admin/reports', 'ReportController@index', 'admin.reports');
$router->get('/admin/reports/rent-collection', 'ReportController@rentCollection');
$router->get('/admin/reports/occupancy', 'ReportController@occupancy');
$router->get('/admin/reports/income-expense', 'ReportController@incomeExpense');
$router->get('/admin/reports/tenant-list', 'ReportController@tenantList');
$router->get('/admin/reports/maintenance', 'ReportController@maintenance');
$router->post('/admin/reports/export-pdf', 'ReportController@exportPdf');
$router->post('/admin/reports/export-excel', 'ReportController@exportExcel');

// Users
$router->get('/admin/users', 'UserController@index', 'admin.users');
$router->post('/admin/users', 'UserController@store');
$router->get('/admin/users/{id}/edit', 'UserController@edit');
$router->post('/admin/users/{id}', 'UserController@update');
$router->post('/admin/users/{id}/delete', 'UserController@destroy');

// Settings
$router->get('/admin/settings', 'SettingsController@index', 'admin.settings');
$router->post('/admin/settings', 'SettingsController@update');
$router->post('/admin/settings/logo', 'SettingsController@uploadLogo');
$router->post('/admin/settings/upload-image', 'SettingsController@uploadImage');
$router->post('/admin/settings/remove-image', 'SettingsController@removeImage');
$router->post('/admin/settings/test-mail', 'SettingsController@testMail');

// Notifications
$router->get('/admin/notifications', 'NotificationController@index', 'admin.notifications');
$router->post('/admin/notifications/send', 'NotificationController@send');
