<?php

namespace App\Policies;

use App\Models\CustomerAppointment;
use App\Models\User;
use App\Services\BranchAccessService;
use App\Support\Authorization\PermissionName;

class CustomerAppointmentPolicy
{
    public function __construct(private BranchAccessService $branchAccess) {}

    public function manageStatus(User $user, CustomerAppointment $appointment): bool
    {
        return $user->can(PermissionName::APPOINTMENTS_MANAGE_STATUS->value)
            && $this->branchAccess->canAccessBranch($user, (int) $appointment->branch_id);
    }
}
