<?php

use CodeIgniter\Router\RouteCollection;

/**
 * @var RouteCollection $routes
 */
$routes->get('/', 'user\HomeController::index');

//route ladind
$routes->get('contact', 'user\ContactController::index');
$routes->get('news', 'user\NewsController::index');
$routes->get('news/view/(:any)', 'user\NewsController::detail/$1');
$routes->get('search', 'user\SearchController::index');
$routes->get('galeri', 'user\GaleriController::index');
$routes->get('galeri/view/(:any)', 'user\GaleriController::detail/$1');
$routes->get('schedule', 'user\ScheduleController::index');
$routes->get('schedule/view/(:any)', 'user\ScheduleController::detail/$1');
$routes->get('about', 'user\AboutController::index');
$routes->get('home', 'user\HomeController::index');
//routelogin
$routes->get('login', 'admin\LoginController::index');
$routes->post('login/authenticate', 'admin\LoginController::authenticate');
$routes->get('logout', 'admin\LoginController::logout');

//filter router
$routes->group('', ['filter' => 'auth'], function ($routes) {

    //dashboard
    $routes->get('dashboard', 'admin\DashboardController::index');
    //route prOFILE
    $routes->get('profile', 'admin\ProfileController::index');
    $routes->get('profile/edit', 'admin\ProfileController::edit');
    $routes->post('profile', 'admin\ProfileController::update');

    //route kontak
    $routes->get('kontak', 'admin\KontakController::index');
    $routes->get('kontak/edit', 'admin\KontakController::edit');
    $routes->post('kontak', 'admin\KontakController::update');

    //route user
    $routes->get('user', 'admin\UserController::index');
    $routes->get('user/add', 'admin\UserController::create');
    $routes->post('user', 'admin\UserController::store');
    $routes->get('user/edit/(:any)', 'admin\UserController::edit/$1');
    $routes->put('user/(:any)', 'admin\UserController::update/$1');
    $routes->delete('user/(:any)', 'admin\UserController::destroy/$1');


    //route berita
    $routes->get('berita', 'admin\BeritaController::index');
    $routes->get('berita/add', 'admin\BeritaController::create');
    $routes->post('berita', 'admin\BeritaController::store');
    $routes->get('berita/edit/(:any)', 'admin\BeritaController::edit/$1');
    $routes->put('berita/(:any)', 'admin\BeritaController::update/$1');
    $routes->delete('berita/(:any)', 'admin\BeritaController::destroy/$1');

    //route agenda
    $routes->get('agenda', 'admin\AgendaController::index');
    $routes->get('agenda/add', 'admin\AgendaController::create');
    $routes->post('agenda', 'admin\AgendaController::store');
    $routes->get('agenda/edit/(:any)', 'admin\AgendaController::edit/$1');
    $routes->put('agenda/(:any)', 'admin\AgendaController::update/$1');
    $routes->delete('agenda/(:any)', 'admin\AgendaController::destroy/$1');
    //route gallery
    $routes->get('gallery', 'admin\GalleryController::index');
    $routes->get('gallery/add', 'admin\GalleryController::create');
    $routes->post('gallery', 'admin\GalleryController::store');
    $routes->get('gallery/edit/(:any)', 'admin\GalleryController::edit/$1');
    $routes->put('gallery/(:any)', 'admin\GalleryController::update/$1');
    $routes->delete('gallery/(:any)', 'admin\GalleryController::destroy/$1');
});