<?php

/**
 * Inventory module routes.
 * @var \CodeIgniter\Router\RouteCollection $routes
 */

$routes->group('inventory', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Inventory\Controllers\InventoryDashboardController::index', ['filter' => 'permission:inventory.view']);
});

$routes->group('inventory/products', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Inventory\Controllers\ProductController::index', ['filter' => 'permission:products.view']);
    $routes->get('create', '\Modules\Inventory\Controllers\ProductController::createForm', ['filter' => 'permission:products.create']);
    $routes->post('/', '\Modules\Inventory\Controllers\ProductController::store', ['filter' => 'permission:products.create']);
    $routes->get('(:num)', '\Modules\Inventory\Controllers\ProductController::show/$1', ['filter' => 'permission:products.view']);
    $routes->get('(:num)/edit', '\Modules\Inventory\Controllers\ProductController::editForm/$1', ['filter' => 'permission:products.edit']);
    $routes->post('(:num)', '\Modules\Inventory\Controllers\ProductController::update/$1', ['filter' => 'permission:products.edit']);
    $routes->post('(:num)/activate', '\Modules\Inventory\Controllers\ProductController::activate/$1', ['filter' => 'permission:products.edit']);
    $routes->post('(:num)/deactivate', '\Modules\Inventory\Controllers\ProductController::deactivate/$1', ['filter' => 'permission:products.edit']);
    $routes->post('(:num)/delete', '\Modules\Inventory\Controllers\ProductController::destroy/$1', ['filter' => 'permission:products.delete']);
});

$routes->group('inventory/categories', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Inventory\Controllers\CategoryController::index', ['filter' => 'permission:categories.view']);
    $routes->get('create', '\Modules\Inventory\Controllers\CategoryController::createForm', ['filter' => 'permission:categories.create']);
    $routes->post('/', '\Modules\Inventory\Controllers\CategoryController::store', ['filter' => 'permission:categories.create']);
    $routes->get('(:num)/edit', '\Modules\Inventory\Controllers\CategoryController::editForm/$1', ['filter' => 'permission:categories.edit']);
    $routes->post('(:num)', '\Modules\Inventory\Controllers\CategoryController::update/$1', ['filter' => 'permission:categories.edit']);
    $routes->post('(:num)/activate', '\Modules\Inventory\Controllers\CategoryController::activate/$1', ['filter' => 'permission:categories.edit']);
    $routes->post('(:num)/deactivate', '\Modules\Inventory\Controllers\CategoryController::deactivate/$1', ['filter' => 'permission:categories.edit']);
    $routes->post('(:num)/delete', '\Modules\Inventory\Controllers\CategoryController::destroy/$1', ['filter' => 'permission:categories.delete']);
});

$routes->group('inventory/brands', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Inventory\Controllers\BrandController::index', ['filter' => 'permission:brands.view']);
    $routes->get('create', '\Modules\Inventory\Controllers\BrandController::createForm', ['filter' => 'permission:brands.create']);
    $routes->post('/', '\Modules\Inventory\Controllers\BrandController::store', ['filter' => 'permission:brands.create']);
    $routes->get('(:num)/edit', '\Modules\Inventory\Controllers\BrandController::editForm/$1', ['filter' => 'permission:brands.edit']);
    $routes->post('(:num)', '\Modules\Inventory\Controllers\BrandController::update/$1', ['filter' => 'permission:brands.edit']);
    $routes->post('(:num)/activate', '\Modules\Inventory\Controllers\BrandController::activate/$1', ['filter' => 'permission:brands.edit']);
    $routes->post('(:num)/deactivate', '\Modules\Inventory\Controllers\BrandController::deactivate/$1', ['filter' => 'permission:brands.edit']);
    $routes->post('(:num)/delete', '\Modules\Inventory\Controllers\BrandController::destroy/$1', ['filter' => 'permission:brands.delete']);
});

$routes->group('inventory/units-of-measure', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Inventory\Controllers\UnitOfMeasureController::index', ['filter' => 'permission:units_of_measure.view']);
    $routes->get('create', '\Modules\Inventory\Controllers\UnitOfMeasureController::createForm', ['filter' => 'permission:units_of_measure.create']);
    $routes->post('/', '\Modules\Inventory\Controllers\UnitOfMeasureController::store', ['filter' => 'permission:units_of_measure.create']);
    $routes->get('(:num)/edit', '\Modules\Inventory\Controllers\UnitOfMeasureController::editForm/$1', ['filter' => 'permission:units_of_measure.edit']);
    $routes->post('(:num)', '\Modules\Inventory\Controllers\UnitOfMeasureController::update/$1', ['filter' => 'permission:units_of_measure.edit']);
    $routes->post('(:num)/activate', '\Modules\Inventory\Controllers\UnitOfMeasureController::activate/$1', ['filter' => 'permission:units_of_measure.edit']);
    $routes->post('(:num)/deactivate', '\Modules\Inventory\Controllers\UnitOfMeasureController::deactivate/$1', ['filter' => 'permission:units_of_measure.edit']);
    $routes->post('(:num)/delete', '\Modules\Inventory\Controllers\UnitOfMeasureController::destroy/$1', ['filter' => 'permission:units_of_measure.delete']);
});

$routes->group('inventory/warehouses', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Inventory\Controllers\WarehouseController::index', ['filter' => 'permission:warehouses.view']);
    $routes->get('create', '\Modules\Inventory\Controllers\WarehouseController::createForm', ['filter' => 'permission:warehouses.create']);
    $routes->post('/', '\Modules\Inventory\Controllers\WarehouseController::store', ['filter' => 'permission:warehouses.create']);
    $routes->get('(:num)/edit', '\Modules\Inventory\Controllers\WarehouseController::editForm/$1', ['filter' => 'permission:warehouses.edit']);
    $routes->post('(:num)', '\Modules\Inventory\Controllers\WarehouseController::update/$1', ['filter' => 'permission:warehouses.edit']);
    $routes->post('(:num)/activate', '\Modules\Inventory\Controllers\WarehouseController::activate/$1', ['filter' => 'permission:warehouses.edit']);
    $routes->post('(:num)/deactivate', '\Modules\Inventory\Controllers\WarehouseController::deactivate/$1', ['filter' => 'permission:warehouses.edit']);
    $routes->post('(:num)/delete', '\Modules\Inventory\Controllers\WarehouseController::destroy/$1', ['filter' => 'permission:warehouses.delete']);
});

$routes->group('inventory/stock', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Inventory\Controllers\StockController::index', ['filter' => 'permission:stock.view']);
    $routes->get('adjust', '\Modules\Inventory\Controllers\StockController::adjustForm', ['filter' => 'permission:stock.adjust']);
    $routes->post('adjust', '\Modules\Inventory\Controllers\StockController::adjust', ['filter' => 'permission:stock.adjust']);
});

$routes->group('inventory/stock-transfers', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Inventory\Controllers\StockTransferController::index', ['filter' => 'permission:stock_transfers.view']);
    $routes->get('create', '\Modules\Inventory\Controllers\StockTransferController::createForm', ['filter' => 'permission:stock_transfers.create']);
    $routes->post('/', '\Modules\Inventory\Controllers\StockTransferController::store', ['filter' => 'permission:stock_transfers.create']);
    $routes->get('(:num)', '\Modules\Inventory\Controllers\StockTransferController::show/$1', ['filter' => 'permission:stock_transfers.view']);
    $routes->get('(:num)/edit', '\Modules\Inventory\Controllers\StockTransferController::editForm/$1', ['filter' => 'permission:stock_transfers.edit']);
    $routes->post('(:num)', '\Modules\Inventory\Controllers\StockTransferController::update/$1', ['filter' => 'permission:stock_transfers.edit']);
    $routes->post('(:num)/complete', '\Modules\Inventory\Controllers\StockTransferController::complete/$1', ['filter' => 'permission:stock_transfers.complete']);
    $routes->post('(:num)/cancel', '\Modules\Inventory\Controllers\StockTransferController::cancel/$1', ['filter' => 'permission:stock_transfers.edit']);
    $routes->post('(:num)/delete', '\Modules\Inventory\Controllers\StockTransferController::destroy/$1', ['filter' => 'permission:stock_transfers.delete']);
});

$routes->group('inventory/stock-adjustments', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Inventory\Controllers\StockAdjustmentController::index', ['filter' => 'permission:stock_adjustments.view']);
    $routes->get('create', '\Modules\Inventory\Controllers\StockAdjustmentController::createForm', ['filter' => 'permission:stock_adjustments.create']);
    $routes->post('/', '\Modules\Inventory\Controllers\StockAdjustmentController::store', ['filter' => 'permission:stock_adjustments.create']);
});

$routes->group('inventory/serial-numbers', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Inventory\Controllers\SerialNumberController::index', ['filter' => 'permission:serial_numbers.view']);
    $routes->get('create', '\Modules\Inventory\Controllers\SerialNumberController::createForm', ['filter' => 'permission:serial_numbers.create']);
    $routes->post('/', '\Modules\Inventory\Controllers\SerialNumberController::store', ['filter' => 'permission:serial_numbers.create']);
    $routes->get('(:num)/edit', '\Modules\Inventory\Controllers\SerialNumberController::editForm/$1', ['filter' => 'permission:serial_numbers.edit']);
    $routes->post('(:num)', '\Modules\Inventory\Controllers\SerialNumberController::update/$1', ['filter' => 'permission:serial_numbers.edit']);
    $routes->post('(:num)/delete', '\Modules\Inventory\Controllers\SerialNumberController::destroy/$1', ['filter' => 'permission:serial_numbers.delete']);
});

$routes->group('inventory/batches', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Inventory\Controllers\BatchController::index', ['filter' => 'permission:batches.view']);
    $routes->get('create', '\Modules\Inventory\Controllers\BatchController::createForm', ['filter' => 'permission:batches.create']);
    $routes->post('/', '\Modules\Inventory\Controllers\BatchController::store', ['filter' => 'permission:batches.create']);
    $routes->get('(:num)/edit', '\Modules\Inventory\Controllers\BatchController::editForm/$1', ['filter' => 'permission:batches.edit']);
    $routes->post('(:num)', '\Modules\Inventory\Controllers\BatchController::update/$1', ['filter' => 'permission:batches.edit']);
    $routes->post('(:num)/delete', '\Modules\Inventory\Controllers\BatchController::destroy/$1', ['filter' => 'permission:batches.delete']);
});

$routes->group('inventory/barcodes', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Inventory\Controllers\BarcodeController::index', ['filter' => 'permission:barcodes.view']);
});

$routes->group('inventory/stock-counts', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Inventory\Controllers\StockCountController::index', ['filter' => 'permission:stock_counts.view']);
    $routes->get('create', '\Modules\Inventory\Controllers\StockCountController::createForm', ['filter' => 'permission:stock_counts.create']);
    $routes->post('/', '\Modules\Inventory\Controllers\StockCountController::store', ['filter' => 'permission:stock_counts.create']);
    $routes->get('(:num)', '\Modules\Inventory\Controllers\StockCountController::show/$1', ['filter' => 'permission:stock_counts.view']);
    $routes->get('(:num)/edit', '\Modules\Inventory\Controllers\StockCountController::editForm/$1', ['filter' => 'permission:stock_counts.edit']);
    $routes->post('(:num)', '\Modules\Inventory\Controllers\StockCountController::update/$1', ['filter' => 'permission:stock_counts.edit']);
    $routes->post('(:num)/complete', '\Modules\Inventory\Controllers\StockCountController::complete/$1', ['filter' => 'permission:stock_counts.complete']);
    $routes->post('(:num)/cancel', '\Modules\Inventory\Controllers\StockCountController::cancel/$1', ['filter' => 'permission:stock_counts.edit']);
    $routes->post('(:num)/delete', '\Modules\Inventory\Controllers\StockCountController::destroy/$1', ['filter' => 'permission:stock_counts.delete']);
});

$routes->group('inventory/reorder-levels', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Inventory\Controllers\ReorderLevelController::index', ['filter' => 'permission:reorder_levels.view']);
    $routes->post('/', '\Modules\Inventory\Controllers\ReorderLevelController::update', ['filter' => 'permission:reorder_levels.edit']);
});

$routes->group('inventory/asset-inventory', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Inventory\Controllers\AssetInventoryController::index', ['filter' => 'permission:asset_inventory.view']);
    $routes->get('create', '\Modules\Inventory\Controllers\AssetInventoryController::createForm', ['filter' => 'permission:asset_inventory.create']);
    $routes->post('/', '\Modules\Inventory\Controllers\AssetInventoryController::store', ['filter' => 'permission:asset_inventory.create']);
    $routes->get('(:num)/edit', '\Modules\Inventory\Controllers\AssetInventoryController::editForm/$1', ['filter' => 'permission:asset_inventory.edit']);
    $routes->post('(:num)', '\Modules\Inventory\Controllers\AssetInventoryController::update/$1', ['filter' => 'permission:asset_inventory.edit']);
    $routes->post('(:num)/delete', '\Modules\Inventory\Controllers\AssetInventoryController::destroy/$1', ['filter' => 'permission:asset_inventory.delete']);
});

$routes->group('inventory/reports', ['filter' => 'auth'], static function ($routes) {
    $routes->get('/', '\Modules\Inventory\Controllers\InventoryReportController::index', ['filter' => 'permission:inventory.reports']);
});
