using CMSMicroservice.Protobuf.Protos.UserCarts;
using CMSMicroservice.WebApi.Common.Services;

namespace CMSMicroservice.WebApi.Services;

public class UserCartsService : UserCartsContract.UserCartsContractBase
{
    private readonly IDispatchRequestToCQRS _dispatcher;

    public UserCartsService(IDispatchRequestToCQRS dispatcher)
    {
        _dispatcher = dispatcher;
    }

    #region Customer Methods

    public override async Task<AddNewUserCartForCustomerResponse> AddNewUserCartForCustomer(
        AddNewUserCartForCustomerRequest request, ServerCallContext context)
    {
        // TODO: Map to DiscountShop AddToCart command
        return new AddNewUserCartForCustomerResponse
        {
            Message = "AddNewUserCartForCustomer not implemented yet"
        };
    }

    public override async Task<UpdateUserCartForCustomerResponse> UpdateUserCartForCustomer(
        UpdateUserCartForCustomerRequest request, ServerCallContext context)
    {
        // TODO: Map to DiscountShop UpdateCartItemCount command
        return new UpdateUserCartForCustomerResponse
        {
            Message = "UpdateUserCartForCustomer not implemented yet"
        };
    }

    public override async Task<RemoveUserCartForCustomerResponse> RemoveUserCartForCustomer(
        RemoveUserCartForCustomerRequest request, ServerCallContext context)
    {
        // TODO: Map to DiscountShop RemoveFromCart command
        return new RemoveUserCartForCustomerResponse
        {
            Message = "RemoveUserCartForCustomer not implemented yet"
        };
    }

    public override async Task<GetUserCartForCustomerResponse> GetCustomerCart(
        GetUserCartForCustomerRequest request, ServerCallContext context)
    {
        // TODO: Map to DiscountShop GetUserCart query
        return new GetUserCartForCustomerResponse();
    }

    #endregion

    #region Admin Methods

    public override async Task<AddNewUserCartResponse> AddNewUserCart(
        AddNewUserCartRequest request, ServerCallContext context)
    {
        throw new RpcException(new Status(StatusCode.Unimplemented, "AddNewUserCart not implemented yet"));
    }

    public override async Task<Empty> UpdateUserCart(
        UpdateUserCartRequest request, ServerCallContext context)
    {
        throw new RpcException(new Status(StatusCode.Unimplemented, "UpdateUserCart not implemented yet"));
    }

    public override async Task<Empty> DeleteUserCart(
        DeleteUserCartRequest request, ServerCallContext context)
    {
        throw new RpcException(new Status(StatusCode.Unimplemented, "DeleteUserCart not implemented yet"));
    }

    public override async Task<GetUserCartResponse> GetUserCart(
        GetUserCartRequest request, ServerCallContext context)
    {
        throw new RpcException(new Status(StatusCode.Unimplemented, "GetUserCart not implemented yet"));
    }

    public override async Task<GetAllUserCartsByFilterResponse> GetAllUserCartsByFilter(
        GetAllUserCartsByFilterRequest request, ServerCallContext context)
    {
        throw new RpcException(new Status(StatusCode.Unimplemented, "GetAllUserCartsByFilter not implemented yet"));
    }

    #endregion
}
