<?php

namespace Modules\Auth\Services;

use App\Models\User;

class RoleAssignmentService
{
    public function sync(User $user, array $roles): void
    {
        $user->syncRoles($roles);
    }

    public function assign(User $user, string $role): void
    {
        if (!$user->hasRole($role)) {
            $user->assignRole($role);
        }
    }

    public function remove(User $user, string $role): void
    {
        if ($user->hasRole($role)) {
            $user->removeRole($role);
        }
    }
}
