using CMSMicroservice.Protobuf.Protos.ProductGalleries;
using CMSMicroservice.WebApi.Common.Services;
using CMSMicroservice.Application.ProductGalleriesCQ.Commands.CreateNewProductGalleries;
using CMSMicroservice.Application.ProductGalleriesCQ.Commands.UpdateProductGalleries;
using CMSMicroservice.Application.ProductGalleriesCQ.Commands.DeleteProductGalleries;
using CMSMicroservice.Application.ProductGalleriesCQ.Queries.GetProductGalleries;
using CMSMicroservice.Application.ProductGalleriesCQ.Queries.GetAllProductGalleriesByFilter;
namespace CMSMicroservice.WebApi.Services;
public class ProductGalleriesService : ProductGalleriesContract.ProductGalleriesContractBase
{
    private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;

    public ProductGalleriesService(IDispatchRequestToCQRS dispatchRequestToCQRS)
    {
        _dispatchRequestToCQRS = dispatchRequestToCQRS;
    }
    public override async Task<CreateNewProductGalleriesResponse> CreateNewProductGalleries(CreateNewProductGalleriesRequest request, ServerCallContext context)
    {
        return await _dispatchRequestToCQRS.Handle<CreateNewProductGalleriesRequest, CreateNewProductGalleriesCommand, CreateNewProductGalleriesResponse>(request, context);
    }
    public override async Task<Empty> UpdateProductGalleries(UpdateProductGalleriesRequest request, ServerCallContext context)
    {
        return await _dispatchRequestToCQRS.Handle<UpdateProductGalleriesRequest, UpdateProductGalleriesCommand>(request, context);
    }
    public override async Task<Empty> DeleteProductGalleries(DeleteProductGalleriesRequest request, ServerCallContext context)
    {
        return await _dispatchRequestToCQRS.Handle<DeleteProductGalleriesRequest, DeleteProductGalleriesCommand>(request, context);
    }
    public override async Task<GetProductGalleriesResponse> GetProductGalleries(GetProductGalleriesRequest request, ServerCallContext context)
    {
        return await _dispatchRequestToCQRS.Handle<GetProductGalleriesRequest, GetProductGalleriesQuery, GetProductGalleriesResponse>(request, context);
    }
    public override async Task<GetAllProductGalleriesByFilterResponse> GetAllProductGalleriesByFilter(GetAllProductGalleriesByFilterRequest request, ServerCallContext context)
    {
        return await _dispatchRequestToCQRS.Handle<GetAllProductGalleriesByFilterRequest, GetAllProductGalleriesByFilterQuery, GetAllProductGalleriesByFilterResponse>(request, context);
    }
}
