<?php

namespace App\Http\Controllers\Api\V1;

use App\Helpers\ApiResponse;
use App\Http\Controllers\Controller;
use App\Services\PermissionService;
use Illuminate\Http\Request;

class PermissionController extends Controller
{
    public function __construct(private PermissionService $service) {}

    public function deptMenuMatrix(int $id, Request $request)
    {
        return ApiResponse::handle(function () use ($id, $request) {
            return $this->service->getMenuMatrix($id, 'department', $request->all());
        }, '부서 메뉴 권한 매트릭스 조회');
    }

    public function roleMenuMatrix(int $id, Request $request)
    {
        return ApiResponse::handle(function () use ($id, $request) {
            return $this->service->getMenuMatrix($id, 'role', $request->all());
        }, '역할 메뉴 권한 매트릭스 조회');
    }

    public function userMenuMatrix(int $id, Request $request)
    {
        return ApiResponse::handle(function () use ($id, $request) {
            return $this->service->getMenuMatrix($id, 'user', $request->all());
        }, '유저 메뉴 권한 매트릭스 조회');
    }
}
