using Femto.Common.Domain;
using MediatR;

namespace Femto.Modules.Blog.Application;

internal class BlogModule(IMediator mediator) : IBlogModule
{
    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
    )
    {
        var response = await mediator.Send(command, cancellationToken);
        return response;
    }

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