<?php

namespace App\Modules\HR\Attendance\Policies;

use App\Models\User;
use App\Modules\HR\Attendance\Models\AttendanceException;

class AttendanceExceptionPolicy
{
    public function viewAny(User $user): bool
    {
        return $user->can('attendance.view');
    }

    public function view(User $user, AttendanceException $exception): bool
    {
        return $user->can('attendance.view') && (int) $user->tenant_id === (int) $exception->tenant_id;
    }

    public function review(User $user, AttendanceException $exception): bool
    {
        return $user->can('attendance.manage') && (int) $user->tenant_id === (int) $exception->tenant_id;
    }
}
