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

namespace TeleWave.Application.Admin.Roles.CreateRole;

public sealed class CreateRoleCommandHandler(IRoleService roleService)
    : ICommandHandler<CreateRoleCommand, Result<RoleDto>>
{
    public Task<Result<RoleDto>> Handle(
        CreateRoleCommand command,
        CancellationToken cancellationToken
    ) => roleService.CreateRoleAsync(command.Name, cancellationToken);
}
