<?php

use CodeIgniter\Router\RouteCollection;

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

// API Routes - 그룹화 없이 직접 경로 지정
// Health check
$routes->get('api/ping', 'Api\PingController::index');

// Authentication
$routes->post('api/auth/login', 'Api\AuthController::login');
$routes->post('api/auth/logout', 'Api\AuthController::logout');
$routes->get('api/auth/check', 'Api\AuthController::check');

// Dashboard
$routes->get('api/dashboard/stats', 'Api\DashboardController::getStats');

// Admin Management
$routes->get('api/admin/check-username', 'Api\AdminController::checkUsername'); // Check username availability
$routes->get('api/admin', 'Api\AdminController::index');
$routes->get('api/admin/(:num)', 'Api\AdminController::show/$1');
$routes->post('api/admin', 'Api\AdminController::create');
$routes->put('api/admin/(:num)', 'Api\AdminController::update/$1');
$routes->delete('api/admin/(:num)', 'Api\AdminController::delete/$1');
$routes->post('api/admin/(:num)/password', 'Api\AdminController::changePassword/$1');
$routes->post('api/admin/(:num)/unlock', 'Api\AdminController::unlockAccount/$1');
$routes->post('api/admin/(:num)/restore', 'Api\AdminController::restore/$1');
$routes->delete('api/admin/(:num)/hard', 'Api\AdminController::hardDelete/$1');

// Fishing Field (낚시분야)
$routes->get('api/field/list', 'Api\FishingFieldController::index');
$routes->get('api/field/(:num)', 'Api\FishingFieldController::show/$1');
$routes->post('api/field', 'Api\FishingFieldController::create');
$routes->put('api/field/(:num)', 'Api\FishingFieldController::update/$1');
$routes->delete('api/field/(:num)', 'Api\FishingFieldController::delete/$1');

// Fishing Area (낚시지역)
$routes->get('api/area/list', 'Api\FishingAreaController::index');
$routes->get('api/area/(:num)/places', 'Api\FishingAreaController::places/$1');
$routes->get('api/area/(:num)', 'Api\FishingAreaController::show/$1');
$routes->post('api/area', 'Api\FishingAreaController::create');
$routes->put('api/area/(:num)', 'Api\FishingAreaController::update/$1');
$routes->delete('api/area/(:num)', 'Api\FishingAreaController::delete/$1');

// Species (어종구분)
$routes->get('api/species/list', 'Api\SpeciesController::index');
$routes->post('api/species', 'Api\SpeciesController::create');
$routes->put('api/species/(:num)', 'Api\SpeciesController::update/$1');
$routes->post('api/species/bulk-save', 'Api\SpeciesController::bulkSave');
$routes->post('api/species/bulk-delete', 'Api\SpeciesController::bulkDelete');

// Species Challenge (어종 챌린지)
$routes->get('api/species-challenge/list', 'Api\SpeciesChallengeController::index');
$routes->post('api/species-challenge/bulk-save', 'Api\SpeciesChallengeController::bulkSave');

// Species Quest (어종 퀘스트)
$routes->get('api/species-quest/list', 'Api\SpeciesQuestController::index');
$routes->post('api/species-quest/bulk-save', 'Api\SpeciesQuestController::bulkSave');

// Item (아이템)
$routes->get('api/item/list', 'Api\ItemController::index');
$routes->get('api/item/(:num)', 'Api\ItemController::show/$1');
$routes->post('api/item', 'Api\ItemController::create');
$routes->put('api/item/(:num)', 'Api\ItemController::update/$1');
$routes->post('api/item/(:num)/image', 'Api\ItemController::uploadImage/$1');
$routes->delete('api/item/(:num)/image', 'Api\ItemController::deleteImage/$1');
$routes->delete('api/item/(:num)', 'Api\ItemController::delete/$1');

// Fishing (낚시터)
$routes->get('api/fishing/list', 'Api\FishingController::index');
$routes->get('api/fishing/(:num)', 'Api\FishingController::show/$1');
$routes->post('api/fishing', 'Api\FishingController::create');
$routes->put('api/fishing/(:num)', 'Api\FishingController::update/$1');
$routes->post('api/fishing/(:num)/photos', 'Api\FishingController::uploadPhotos/$1');
$routes->delete('api/fishing/photo/(:num)', 'Api\FishingController::deletePhoto/$1');
$routes->delete('api/fishing/(:num)', 'Api\FishingController::delete/$1');

// Onboard (선상)
$routes->get('api/onboard/list', 'Api\OnboardController::index');
$routes->get('api/onboard/(:num)', 'Api\OnboardController::show/$1');
$routes->post('api/onboard', 'Api\OnboardController::create');
$routes->put('api/onboard/(:num)', 'Api\OnboardController::update/$1');
$routes->post('api/onboard/(:num)/photos', 'Api\OnboardController::uploadPhotos/$1');
$routes->delete('api/onboard/photo/(:num)', 'Api\OnboardController::deletePhoto/$1');
$routes->delete('api/onboard/(:num)', 'Api\OnboardController::delete/$1');

// Challenge (챌린지)
$routes->get('api/challenge/draft', 'Api\ChallengeController::showDraft');
$routes->post('api/challenge/draft', 'Api\ChallengeController::saveDraft');
$routes->delete('api/challenge/draft', 'Api\ChallengeController::deleteDraft');
$routes->get('api/challenge/list', 'Api\ChallengeController::index');
$routes->get('api/challenge/(:num)', 'Api\ChallengeController::show/$1');
$routes->post('api/challenge', 'Api\ChallengeController::create');
$routes->put('api/challenge/(:num)', 'Api\ChallengeController::update/$1');
$routes->post('api/challenge/round/(:num)/close', 'Api\ChallengeController::closeRound/$1');
$routes->post('api/challenge/(:num)/image', 'Api\ChallengeController::uploadImage/$1');
$routes->delete('api/challenge/(:num)/image', 'Api\ChallengeController::deleteImage/$1');
$routes->delete('api/challenge/(:num)', 'Api\ChallengeController::delete/$1');

// Users (회원)
$routes->post('api/users/login', 'Api\UsersController::login');
$routes->post('api/users/logout', 'Api\UsersController::logout');
$routes->post('api/users/check-username', 'Api\UsersController::checkUsername');
$routes->post('api/users/check-nickname', 'Api\UsersController::checkNickname');
$routes->post('api/users/signup', 'Api\UsersController::signup');
$routes->post('api/users/find-id', 'Api\UsersController::findId');
$routes->post('api/users/verify-for-reset', 'Api\UsersController::verifyForReset');
$routes->post('api/users/reset-password', 'Api\UsersController::resetPassword');

// File Upload
$routes->post('api/upload/file', 'Api\UploadController::uploadFile');
$routes->post('api/upload/image', 'Api\UploadController::uploadImage');
