<?php

declare(strict_types=1);

namespace App\Policies;

use App\Models\AcademyPromptTemplate;
use App\Models\User;
use App\Services\Academy\AcademyAccessService;

class AcademyPromptTemplatePolicy
{
    public function before(?User $user): ?bool
    {
        if ($user?->isAdmin()) {
            return true;
        }

        return null;
    }

    public function view(?User $user, AcademyPromptTemplate $prompt): bool
    {
        return app(AcademyAccessService::class)->canAccessPrompt($user, $prompt);
    }

    public function manage(User $user): bool
    {
        return $user->hasStaffAccess();
    }
}