<?php

namespace App\Policies;

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

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

    public function retry(User $user, ReminderNotificationLog $notification): bool
    {
        return $user->can(PermissionName::NOTIFICATIONS_RETRY->value)
            && $this->branchAccess->canAccessBranch($user, (int) $notification->branch_id);
    }
}
