using Femto.Common.Domain;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace Femto.Modules.Auth.Application;

internal class AuthModule(IMediator mediator) : IAuthModule
{
    public async Task Command(ICommand command, CancellationToken cancellationToken = default) =>
        await mediator.Send(command, cancellationToken);

    public async Task<TResponse> Command<TResponse>(
        ICommand<TResponse> command,
        CancellationToken cancellationToken = default
    ) => await mediator.Send(command, cancellationToken);

    public async Task<TResponse> Query<TResponse>(
        IQuery<TResponse> query,
        CancellationToken cancellationToken = default
    ) => await mediator.Send(query, cancellationToken);
}
