<?php

namespace App\Policies;

use App\Models\Procedure;
use App\Models\User;

class ProcedurePolicy
{
    public function viewAny(User $user): bool
    {
        return $user->can('treatment-plans.view') || $user->can('settings.manage');
    }

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

    public function update(User $user, Procedure $procedure): bool
    {
        return $user->can('settings.manage') && $procedure->tenant_id === $user->tenant_id;
    }

    public function delete(User $user, Procedure $procedure): bool
    {
        return $this->update($user, $procedure);
    }
}
