<?php

namespace App\Policies;

use App\Models\LeaveApplication;
use App\Models\User;

class LeaveApplicationPolicy
{
    public function viewAny(User $user): bool
    {
        return $user->isSuperAdmin() || $user->isAdminTU() || $user->hasPermissionTo('leave.apply') || $user->hasPermissionTo('leave.approve');
    }

    public function create(User $user): bool
    {
        return $user->isSuperAdmin() || $user->isAdminTU() || $user->hasPermissionTo('leave.apply');
    }

    public function approve(User $user, LeaveApplication $application): bool
    {
        return $user->isSuperAdmin() || $user->isAdminTU() || $user->hasPermissionTo('leave.approve');
    }

    public function reject(User $user, LeaveApplication $application): bool
    {
        return $user->isSuperAdmin() || $user->isAdminTU() || $user->hasPermissionTo('leave.approve');
    }
}
