<?php

declare(strict_types=1);

namespace App\Filament\Concerns;

use App\Services\DberpPermissionService;
use Illuminate\Support\Facades\Auth;

trait InteractsWithDberpPermissions
{
    protected static function allowsPermission(string $permissionCode): bool
    {
        return app(DberpPermissionService::class)->allows(Auth::user(), $permissionCode);
    }

    /**
     * @param  list<string>  $permissionCodes
     */
    protected static function allowsAnyPermission(array $permissionCodes): bool
    {
        return app(DberpPermissionService::class)->allowsAny(Auth::user(), $permissionCodes);
    }

    protected static function allowsReportExport(string $reportKey): bool
    {
        return app(DberpPermissionService::class)->allowsReportExport(Auth::user(), $reportKey);
    }
}
