using Application.Abstractions.Messaging;
﻿using Application.Abstractions.Identity;

namespace Application.Features.Director.Role.Get
{
    public sealed class Handler(IIdentityRoleReader roleReader) : IQueryHandler<Query, Response>
    {
        public async Task<Response> Handle(Query request, CancellationToken ct)
        {
            var role = await roleReader.GetRoleAsync(request.ID, ct);

            return new Response
            {
                ID = role.ID,
                Name = role.Name,
                ClaimsCount = role.Claims.Count
            };
        }
    }
}