<?php
/// file: routes/web.php

declare(strict_types=1);

use App\Middleware\AuthMiddleware;

$r = $app->router();

$r->get('/', 'App\Controllers\HomeController@index');
$r->get('/studio', 'App\Controllers\StudioController@index');
$r->get('/about', 'App\Controllers\AboutController@index');
$r->get('/work', 'App\Controllers\WorkController@index');
$r->get('/work/{slug}', 'App\Controllers\ProjectController@show');
$r->get('/services', 'App\Controllers\ServiceController@index');
$r->get('/journal', 'App\Controllers\JournalController@index');
$r->get('/journal/{slug}', 'App\Controllers\JournalController@show');
$r->get('/contact', 'App\Controllers\ContactController@index');
$r->post('/contact', 'App\Controllers\ContactController@submit');
$r->get('/careers', 'App\Controllers\CareersController@index');
$r->post('/careers', 'App\Controllers\CareersController@submit');
$r->get('/sitemap.xml', 'App\Controllers\SitemapController@index');

$r->get('/admin/login', 'App\Controllers\Admin\AuthController@form');
$r->post('/admin/login', 'App\Controllers\Admin\AuthController@login');
$r->get('/admin/logout', 'App\Controllers\Admin\AuthController@logout');

$r->get('/admin', 'App\Controllers\Admin\DashboardController@index', [AuthMiddleware::class]);
$r->get('/admin/projects', 'App\Controllers\Admin\ProjectAdminController@index', [AuthMiddleware::class]);
$r->get('/admin/projects/create', 'App\Controllers\Admin\ProjectAdminController@create', [AuthMiddleware::class]);
$r->post('/admin/projects/create', 'App\Controllers\Admin\ProjectAdminController@store', [AuthMiddleware::class]);
$r->get('/admin/projects/edit/{id}', 'App\Controllers\Admin\ProjectAdminController@edit', [AuthMiddleware::class]);
$r->post('/admin/projects/edit/{id}', 'App\Controllers\Admin\ProjectAdminController@update', [AuthMiddleware::class]);
$r->post('/admin/projects/delete/{id}', 'App\Controllers\Admin\ProjectAdminController@destroy', [AuthMiddleware::class]);

$r->get('/admin/journal', 'App\Controllers\Admin\JournalAdminController@index', [AuthMiddleware::class]);
$r->get('/admin/journal/create', 'App\Controllers\Admin\JournalAdminController@create', [AuthMiddleware::class]);
$r->post('/admin/journal/create', 'App\Controllers\Admin\JournalAdminController@store', [AuthMiddleware::class]);
$r->get('/admin/journal/edit/{id}', 'App\Controllers\Admin\JournalAdminController@edit', [AuthMiddleware::class]);
$r->post('/admin/journal/edit/{id}', 'App\Controllers\Admin\JournalAdminController@update', [AuthMiddleware::class]);
$r->post('/admin/journal/delete/{id}', 'App\Controllers\Admin\JournalAdminController@destroy', [AuthMiddleware::class]);

$r->get('/admin/services', 'App\Controllers\Admin\ServiceAdminController@index', [AuthMiddleware::class]);
$r->get('/admin/services/create', 'App\Controllers\Admin\ServiceAdminController@create', [AuthMiddleware::class]);
$r->post('/admin/services/create', 'App\Controllers\Admin\ServiceAdminController@store', [AuthMiddleware::class]);
$r->get('/admin/services/edit/{id}', 'App\Controllers\Admin\ServiceAdminController@edit', [AuthMiddleware::class]);
$r->post('/admin/services/edit/{id}', 'App\Controllers\Admin\ServiceAdminController@update', [AuthMiddleware::class]);
$r->post('/admin/services/delete/{id}', 'App\Controllers\Admin\ServiceAdminController@destroy', [AuthMiddleware::class]);

$r->get('/admin/contacts', 'App\Controllers\Admin\ContactAdminController@index', [AuthMiddleware::class]);
$r->get('/admin/contacts/view/{id}', 'App\Controllers\Admin\ContactAdminController@show', [AuthMiddleware::class]);
$r->post('/admin/contacts/status/{id}', 'App\Controllers\Admin\ContactAdminController@status', [AuthMiddleware::class]);

$r->get('/admin/careers', 'App\Controllers\Admin\CareerController@index', [AuthMiddleware::class]);
$r->get('/admin/careers/create', 'App\Controllers\Admin\CareerController@create', [AuthMiddleware::class]);
$r->post('/admin/careers/create', 'App\Controllers\Admin\CareerController@store', [AuthMiddleware::class]);
$r->get('/admin/careers/edit/{id}', 'App\Controllers\Admin\CareerController@edit', [AuthMiddleware::class]);
$r->post('/admin/careers/edit/{id}', 'App\Controllers\Admin\CareerController@update', [AuthMiddleware::class]);
$r->post('/admin/careers/delete/{id}', 'App\Controllers\Admin\CareerController@destroy', [AuthMiddleware::class]);
$r->get('/admin/applications', 'App\Controllers\Admin\CareerController@applications', [AuthMiddleware::class]);

$r->get('/admin/media', 'App\Controllers\Admin\MediaAdminController@index', [AuthMiddleware::class]);
$r->post('/admin/media/global', 'App\Controllers\Admin\MediaAdminController@saveGlobal', [AuthMiddleware::class]);
$r->post('/admin/media/project/{id}', 'App\Controllers\Admin\MediaAdminController@saveProject', [AuthMiddleware::class]);
$r->post('/admin/media/journal/{id}', 'App\Controllers\Admin\MediaAdminController@saveJournal', [AuthMiddleware::class]);
$r->post('/admin/media/seo', 'App\Controllers\Admin\MediaAdminController@saveSeo', [AuthMiddleware::class]);

$r->get('/admin/settings', 'App\Controllers\Admin\SettingsController@index', [AuthMiddleware::class]);
$r->post('/admin/settings', 'App\Controllers\Admin\SettingsController@save', [AuthMiddleware::class]);
$r->get('/admin/seo', 'App\Controllers\Admin\SeoAdminController@index', [AuthMiddleware::class]);
$r->post('/admin/seo', 'App\Controllers\Admin\SeoAdminController@save', [AuthMiddleware::class]);
$r->post('/locale', 'App\Controllers\LocaleController@switch');
