<?php

declare(strict_types=1);

use apexl\Io\includes\RouteManager;
use apexl\Io\modules\product\Controller\ProductController;
use apexl\Io\modules\product\Enum\permissions\ProductPermission;

/** @var RouteManager $routeManager */

$view   = serialize(ProductPermission::CAN_VIEW_PRODUCTS);
$manage = serialize(ProductPermission::CAN_MANAGE_PRODUCTS);

$routeManager->get('product.index', '/api/v1/products', ProductController::class . '::index');
$routeManager->addRouteArg('product.index', 'permission', $view);

$routeManager->post('product.create', '/api/v1/products', ProductController::class . '::create');
$routeManager->addRouteArg('product.create', 'permission', $manage);

$routeManager->get('product.get', '/api/v1/products/{id}', ProductController::class . '::get');
$routeManager->addRouteArg('product.get', 'permission', $view);

$routeManager->put('product.update', '/api/v1/products/{id}', ProductController::class . '::update');
$routeManager->addRouteArg('product.update', 'permission', $manage);

$routeManager->delete('product.delete', '/api/v1/products/{id}', ProductController::class . '::delete');
$routeManager->addRouteArg('product.delete', 'permission', $manage);
