using CMSMicroservice.Protobuf.Protos.ClubMembershipCycleHistory;
using CMSMicroservice.WebApi.Common.Services;
using CMSMicroservice.Application.ClubMembershipCycleHistoryCQ.Queries.GetAllClubMembershipCycleHistoryByFilter;

namespace CMSMicroservice.WebApi.Services;

public class ClubMembershipCycleHistoryService : ClubMembershipCycleHistoryContract.ClubMembershipCycleHistoryContractBase
{
    private readonly IDispatchRequestToCQRS _dispatch;

    public ClubMembershipCycleHistoryService(IDispatchRequestToCQRS dispatch) => _dispatch = dispatch;

    public override Task<GetAllClubMembershipCycleHistoryByFilterResponse> GetAllClubMembershipCycleHistoryByFilter(
        GetAllClubMembershipCycleHistoryByFilterRequest request, ServerCallContext context) =>
        _dispatch.Handle<GetAllClubMembershipCycleHistoryByFilterRequest, GetAllClubMembershipCycleHistoryByFilterQuery, GetAllClubMembershipCycleHistoryByFilterResponse>(request, context);
}
