using LiteCqrs;
using TeleWave.Application.Common.Interfaces;
using TeleWave.Application.Common.Models;

namespace TeleWave.Application.Admin.Roles.UpdateRole;

public sealed class UpdateRoleCommandHandler(IRoleService roleService)
    : ICommandHandler<UpdateRoleCommand, Result<RoleDto>>
{
    public Task<Result<RoleDto>> Handle(
        UpdateRoleCommand command,
        CancellationToken cancellationToken
    ) => roleService.UpdateRoleAsync(command.Id, command.Name, cancellationToken);
}
