using CMSMicroservice.Protobuf.Protos.UserWalletHistory;
using CMSMicroservice.WebApi.Common.Services;
using CMSMicroservice.Application.UserWalletHistoryCQ.Commands.CreateNewUserWalletHistory;
using CMSMicroservice.Application.UserWalletHistoryCQ.Commands.UpdateUserWalletHistory;
using CMSMicroservice.Application.UserWalletHistoryCQ.Commands.DeleteUserWalletHistory;
using CMSMicroservice.Application.UserWalletHistoryCQ.Queries.GetUserWalletHistory;
using CMSMicroservice.Application.UserWalletHistoryCQ.Queries.GetAllUserWalletHistoryByFilter;
namespace CMSMicroservice.WebApi.Services;
public class UserWalletHistoryService : UserWalletHistoryContract.UserWalletHistoryContractBase
{
    private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;

    public UserWalletHistoryService(IDispatchRequestToCQRS dispatchRequestToCQRS)
    {
        _dispatchRequestToCQRS = dispatchRequestToCQRS;
    }
    public override async Task<CreateNewUserWalletHistoryResponse> CreateNewUserWalletHistory(CreateNewUserWalletHistoryRequest request, ServerCallContext context)
    {
        return await _dispatchRequestToCQRS.Handle<CreateNewUserWalletHistoryRequest, CreateNewUserWalletHistoryCommand, CreateNewUserWalletHistoryResponse>(request, context);
    }
    public override async Task<Empty> UpdateUserWalletHistory(UpdateUserWalletHistoryRequest request, ServerCallContext context)
    {
        return await _dispatchRequestToCQRS.Handle<UpdateUserWalletHistoryRequest, UpdateUserWalletHistoryCommand>(request, context);
    }
    public override async Task<Empty> DeleteUserWalletHistory(DeleteUserWalletHistoryRequest request, ServerCallContext context)
    {
        return await _dispatchRequestToCQRS.Handle<DeleteUserWalletHistoryRequest, DeleteUserWalletHistoryCommand>(request, context);
    }
    public override async Task<GetUserWalletHistoryResponse> GetUserWalletHistory(GetUserWalletHistoryRequest request, ServerCallContext context)
    {
        return await _dispatchRequestToCQRS.Handle<GetUserWalletHistoryRequest, GetUserWalletHistoryQuery, GetUserWalletHistoryResponse>(request, context);
    }
    public override async Task<GetAllUserWalletHistoryByFilterResponse> GetAllUserWalletHistoryByFilter(GetAllUserWalletHistoryByFilterRequest request, ServerCallContext context)
    {
        return await _dispatchRequestToCQRS.Handle<GetAllUserWalletHistoryByFilterRequest, GetAllUserWalletHistoryByFilterQuery, GetAllUserWalletHistoryByFilterResponse>(request, context);
    }
}
