<?php

declare(strict_types=1);

namespace App\Policies;

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

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

        return null;
    }

    public function view(?User $user, AcademyPromptPack $pack): bool
    {
        return app(AcademyAccessService::class)->canAccessPack($user, $pack);
    }

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