<?php

namespace App\Policies;

use App\Models\Allocation;
use App\Models\User;

class AllocationPolicy
{
    /**
     * Determine whether the user can view any allocations.
     */
    public function viewAny(User $user): bool
    {
        return true;
    }

    /**
     * Determine whether the user can view a specific allocation.
     */
    public function view(User $user, Allocation $allocation): bool
    {
        return true;
    }

    /**
     * Determine whether the user can create allocations.
     */
    public function create(User $user): bool
    {
        return in_array($user->role, ['superuser', 'manager']);
    }

    /**
     * Determine whether the user can update allocations.
     */
    public function update(User $user, Allocation $allocation): bool
    {
        return in_array($user->role, ['superuser', 'manager']);
    }

    /**
     * Determine whether the user can delete allocations.
     */
    public function delete(User $user, Allocation $allocation): bool
    {
        return in_array($user->role, ['superuser', 'manager']);
    }
}
