<?php

namespace App\Modules\HR\Contracts\Policies;

use App\Models\User;
use App\Modules\HR\Contracts\Models\ContractTemplate;

class ContractTemplatePolicy
{
    public function viewAny(User $user): bool
    {
        return $user->can('contract_templates.manage');
    }

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

    public function update(User $user, ContractTemplate $template): bool
    {
        return (int) $user->tenant_id === (int) $template->tenant_id
            && $user->can('contract_templates.manage');
    }
}
