<?php

namespace App\Modules\HR\Recruitment\Policies;

use App\Models\User;
use App\Modules\HR\Recruitment\Models\RecruitmentOnboardingCase;

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

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

    public function manage(User $user, RecruitmentOnboardingCase $case): bool
    {
        return (int) $user->tenant_id === (int) $case->tenant_id
            && $user->can('recruitment.manage');
    }

    public function create(User $user): bool
    {
        return $user->can('recruitment.manage');
    }
}
