using MediatR;
using Modules.User.Application.Gateways;

namespace Modules.User.Application.Queries;

public class GetUserQuery : IRequest<Models.User>
{
    public Guid AccountId { get; set; } = default!;
    public Guid? SessionId { get; set; }
}

public class GetUserQueryHandler(IUserGateway userGateway) : IRequestHandler<GetUserQuery, Models.User>
{
    public async Task<Models.User> Handle(GetUserQuery request, CancellationToken cancellationToken)
    {
        return await userGateway.GetUser(request.AccountId, request.SessionId) ?? new Models.User();
    }
}