/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements.  See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

    package com.ywt.gapi.nat;

import org.apache.dubbo.common.stream.StreamObserver;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.PathResolver;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.rpc.ServerService;
import org.apache.dubbo.rpc.TriRpcStatus;
import org.apache.dubbo.rpc.model.MethodDescriptor;
import org.apache.dubbo.rpc.model.ServiceDescriptor;
import org.apache.dubbo.rpc.model.StubMethodDescriptor;
import org.apache.dubbo.rpc.model.StubServiceDescriptor;
import org.apache.dubbo.rpc.stub.BiStreamMethodHandler;
import org.apache.dubbo.rpc.stub.ServerStreamMethodHandler;
import org.apache.dubbo.rpc.stub.StubInvocationUtil;
import org.apache.dubbo.rpc.stub.StubInvoker;
import org.apache.dubbo.rpc.stub.StubMethodHandler;
import org.apache.dubbo.rpc.stub.StubSuppliers;
import org.apache.dubbo.rpc.stub.UnaryStubMethodHandler;

import com.google.protobuf.Message;

import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.concurrent.CompletableFuture;

public final class DubboNatServiceTriple {

    public static final String SERVICE_NAME = NatService.SERVICE_NAME;

    private static final StubServiceDescriptor serviceDescriptor = new StubServiceDescriptor(SERVICE_NAME,NatService.class);

    static {
        org.apache.dubbo.rpc.protocol.tri.service.SchemaDescriptorRegistry.addSchemaDescriptor(SERVICE_NAME,NatProto.getDescriptor());
        StubSuppliers.addSupplier(SERVICE_NAME, DubboNatServiceTriple::newStub);
        StubSuppliers.addSupplier(NatService.JAVA_SERVICE_NAME,  DubboNatServiceTriple::newStub);
        StubSuppliers.addDescriptor(SERVICE_NAME, serviceDescriptor);
        StubSuppliers.addDescriptor(NatService.JAVA_SERVICE_NAME, serviceDescriptor);
    }

    @SuppressWarnings("all")
    public static NatService newStub(Invoker<?> invoker) {
        return new NatServiceStub((Invoker<NatService>)invoker);
    }

    /**
         * <pre>
         *  医院 id
         * </pre>
         */
    private static final StubMethodDescriptor createOrderMethod = new StubMethodDescriptor("createOrder",
    com.ywt.gapi.nat.CreateOrderRequest.class, com.ywt.gapi.nat.CreateOrderResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.CreateOrderRequest::parseFrom,
    com.ywt.gapi.nat.CreateOrderResponse::parseFrom);

    private static final StubMethodDescriptor createOrderAsyncMethod = new StubMethodDescriptor("createOrder",
    com.ywt.gapi.nat.CreateOrderRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.CreateOrderRequest::parseFrom,
    com.ywt.gapi.nat.CreateOrderResponse::parseFrom);

    private static final StubMethodDescriptor createOrderProxyAsyncMethod = new StubMethodDescriptor("createOrderAsync",
    com.ywt.gapi.nat.CreateOrderRequest.class, com.ywt.gapi.nat.CreateOrderResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.CreateOrderRequest::parseFrom,
    com.ywt.gapi.nat.CreateOrderResponse::parseFrom);

    private static final StubMethodDescriptor getConfigMethod = new StubMethodDescriptor("getConfig",
    com.ywt.gapi.nat.GetConfigRequest.class, com.ywt.gapi.nat.GetConfigResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.GetConfigRequest::parseFrom,
    com.ywt.gapi.nat.GetConfigResponse::parseFrom);

    private static final StubMethodDescriptor getConfigAsyncMethod = new StubMethodDescriptor("getConfig",
    com.ywt.gapi.nat.GetConfigRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.GetConfigRequest::parseFrom,
    com.ywt.gapi.nat.GetConfigResponse::parseFrom);

    private static final StubMethodDescriptor getConfigProxyAsyncMethod = new StubMethodDescriptor("getConfigAsync",
    com.ywt.gapi.nat.GetConfigRequest.class, com.ywt.gapi.nat.GetConfigResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.GetConfigRequest::parseFrom,
    com.ywt.gapi.nat.GetConfigResponse::parseFrom);

    private static final StubMethodDescriptor getOrderDetailMethod = new StubMethodDescriptor("getOrderDetail",
    com.ywt.gapi.nat.GetOrderDetailRequest.class, com.ywt.gapi.nat.GetOrderDetailResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.GetOrderDetailRequest::parseFrom,
    com.ywt.gapi.nat.GetOrderDetailResponse::parseFrom);

    private static final StubMethodDescriptor getOrderDetailAsyncMethod = new StubMethodDescriptor("getOrderDetail",
    com.ywt.gapi.nat.GetOrderDetailRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.GetOrderDetailRequest::parseFrom,
    com.ywt.gapi.nat.GetOrderDetailResponse::parseFrom);

    private static final StubMethodDescriptor getOrderDetailProxyAsyncMethod = new StubMethodDescriptor("getOrderDetailAsync",
    com.ywt.gapi.nat.GetOrderDetailRequest.class, com.ywt.gapi.nat.GetOrderDetailResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.GetOrderDetailRequest::parseFrom,
    com.ywt.gapi.nat.GetOrderDetailResponse::parseFrom);

    private static final StubMethodDescriptor getOrderListMethod = new StubMethodDescriptor("getOrderList",
    com.ywt.gapi.nat.GetOrderListRequest.class, com.ywt.gapi.nat.GetOrderListResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.GetOrderListRequest::parseFrom,
    com.ywt.gapi.nat.GetOrderListResponse::parseFrom);

    private static final StubMethodDescriptor getOrderListAsyncMethod = new StubMethodDescriptor("getOrderList",
    com.ywt.gapi.nat.GetOrderListRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.GetOrderListRequest::parseFrom,
    com.ywt.gapi.nat.GetOrderListResponse::parseFrom);

    private static final StubMethodDescriptor getOrderListProxyAsyncMethod = new StubMethodDescriptor("getOrderListAsync",
    com.ywt.gapi.nat.GetOrderListRequest.class, com.ywt.gapi.nat.GetOrderListResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.GetOrderListRequest::parseFrom,
    com.ywt.gapi.nat.GetOrderListResponse::parseFrom);

    private static final StubMethodDescriptor payCallbackMethod = new StubMethodDescriptor("payCallback",
    com.ywt.gapi.nat.PayCallbackRequest.class, com.ywt.gapi.nat.PayCallbackResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.PayCallbackRequest::parseFrom,
    com.ywt.gapi.nat.PayCallbackResponse::parseFrom);

    private static final StubMethodDescriptor payCallbackAsyncMethod = new StubMethodDescriptor("payCallback",
    com.ywt.gapi.nat.PayCallbackRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.PayCallbackRequest::parseFrom,
    com.ywt.gapi.nat.PayCallbackResponse::parseFrom);

    private static final StubMethodDescriptor payCallbackProxyAsyncMethod = new StubMethodDescriptor("payCallbackAsync",
    com.ywt.gapi.nat.PayCallbackRequest.class, com.ywt.gapi.nat.PayCallbackResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.PayCallbackRequest::parseFrom,
    com.ywt.gapi.nat.PayCallbackResponse::parseFrom);

    /**
         * <pre>
         *  预约日期，yyyy-MM-dd
         * </pre>
         */
    private static final StubMethodDescriptor refundNatOrderCallbackMethod = new StubMethodDescriptor("refundNatOrderCallback",
    com.ywt.gapi.nat.RefundNatOrderCallbackRequest.class, com.ywt.gapi.nat.RefundNatOrderCallbackResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.RefundNatOrderCallbackRequest::parseFrom,
    com.ywt.gapi.nat.RefundNatOrderCallbackResponse::parseFrom);

    private static final StubMethodDescriptor refundNatOrderCallbackAsyncMethod = new StubMethodDescriptor("refundNatOrderCallback",
    com.ywt.gapi.nat.RefundNatOrderCallbackRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.RefundNatOrderCallbackRequest::parseFrom,
    com.ywt.gapi.nat.RefundNatOrderCallbackResponse::parseFrom);

    private static final StubMethodDescriptor refundNatOrderCallbackProxyAsyncMethod = new StubMethodDescriptor("refundNatOrderCallbackAsync",
    com.ywt.gapi.nat.RefundNatOrderCallbackRequest.class, com.ywt.gapi.nat.RefundNatOrderCallbackResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.RefundNatOrderCallbackRequest::parseFrom,
    com.ywt.gapi.nat.RefundNatOrderCallbackResponse::parseFrom);

    /**
         * <pre>
         *  预约时间段：1-上午；2-下午；
         * </pre>
         */
    private static final StubMethodDescriptor refundMethod = new StubMethodDescriptor("refund",
    com.ywt.gapi.nat.RefundOrderRequest.class, com.ywt.gapi.nat.BaseInfoResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.RefundOrderRequest::parseFrom,
    com.ywt.gapi.nat.BaseInfoResponse::parseFrom);

    private static final StubMethodDescriptor refundAsyncMethod = new StubMethodDescriptor("refund",
    com.ywt.gapi.nat.RefundOrderRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.RefundOrderRequest::parseFrom,
    com.ywt.gapi.nat.BaseInfoResponse::parseFrom);

    private static final StubMethodDescriptor refundProxyAsyncMethod = new StubMethodDescriptor("refundAsync",
    com.ywt.gapi.nat.RefundOrderRequest.class, com.ywt.gapi.nat.BaseInfoResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.RefundOrderRequest::parseFrom,
    com.ywt.gapi.nat.BaseInfoResponse::parseFrom);

    /**
         * <pre>
         *  现住址
         * </pre>
         */
    private static final StubMethodDescriptor cancelOrderMethod = new StubMethodDescriptor("cancelOrder",
    com.ywt.gapi.nat.CancelOrderRequest.class, com.ywt.gapi.nat.BaseInfoResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.CancelOrderRequest::parseFrom,
    com.ywt.gapi.nat.BaseInfoResponse::parseFrom);

    private static final StubMethodDescriptor cancelOrderAsyncMethod = new StubMethodDescriptor("cancelOrder",
    com.ywt.gapi.nat.CancelOrderRequest.class, java.util.concurrent.CompletableFuture.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.CancelOrderRequest::parseFrom,
    com.ywt.gapi.nat.BaseInfoResponse::parseFrom);

    private static final StubMethodDescriptor cancelOrderProxyAsyncMethod = new StubMethodDescriptor("cancelOrderAsync",
    com.ywt.gapi.nat.CancelOrderRequest.class, com.ywt.gapi.nat.BaseInfoResponse.class, serviceDescriptor, MethodDescriptor.RpcType.UNARY,
    obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), com.ywt.gapi.nat.CancelOrderRequest::parseFrom,
    com.ywt.gapi.nat.BaseInfoResponse::parseFrom);





    public static class NatServiceStub implements NatService{
        private final Invoker<NatService> invoker;

        public NatServiceStub(Invoker<NatService> invoker) {
            this.invoker = invoker;
        }

            /**
         * <pre>
         *  医院 id
         * </pre>
         */
        @Override
        public com.ywt.gapi.nat.CreateOrderResponse createOrder(com.ywt.gapi.nat.CreateOrderRequest request){
            return StubInvocationUtil.unaryCall(invoker, createOrderMethod, request);
        }

        public CompletableFuture<com.ywt.gapi.nat.CreateOrderResponse> createOrderAsync(com.ywt.gapi.nat.CreateOrderRequest request){
            return StubInvocationUtil.unaryCall(invoker, createOrderAsyncMethod, request);
        }

            /**
         * <pre>
         *  医院 id
         * </pre>
         */
        @Override
        public void createOrder(com.ywt.gapi.nat.CreateOrderRequest request, StreamObserver<com.ywt.gapi.nat.CreateOrderResponse> responseObserver){
            StubInvocationUtil.unaryCall(invoker, createOrderMethod , request, responseObserver);
        }
        @Override
        public com.ywt.gapi.nat.GetConfigResponse getConfig(com.ywt.gapi.nat.GetConfigRequest request){
            return StubInvocationUtil.unaryCall(invoker, getConfigMethod, request);
        }

        public CompletableFuture<com.ywt.gapi.nat.GetConfigResponse> getConfigAsync(com.ywt.gapi.nat.GetConfigRequest request){
            return StubInvocationUtil.unaryCall(invoker, getConfigAsyncMethod, request);
        }

        @Override
        public void getConfig(com.ywt.gapi.nat.GetConfigRequest request, StreamObserver<com.ywt.gapi.nat.GetConfigResponse> responseObserver){
            StubInvocationUtil.unaryCall(invoker, getConfigMethod , request, responseObserver);
        }
        @Override
        public com.ywt.gapi.nat.GetOrderDetailResponse getOrderDetail(com.ywt.gapi.nat.GetOrderDetailRequest request){
            return StubInvocationUtil.unaryCall(invoker, getOrderDetailMethod, request);
        }

        public CompletableFuture<com.ywt.gapi.nat.GetOrderDetailResponse> getOrderDetailAsync(com.ywt.gapi.nat.GetOrderDetailRequest request){
            return StubInvocationUtil.unaryCall(invoker, getOrderDetailAsyncMethod, request);
        }

        @Override
        public void getOrderDetail(com.ywt.gapi.nat.GetOrderDetailRequest request, StreamObserver<com.ywt.gapi.nat.GetOrderDetailResponse> responseObserver){
            StubInvocationUtil.unaryCall(invoker, getOrderDetailMethod , request, responseObserver);
        }
        @Override
        public com.ywt.gapi.nat.GetOrderListResponse getOrderList(com.ywt.gapi.nat.GetOrderListRequest request){
            return StubInvocationUtil.unaryCall(invoker, getOrderListMethod, request);
        }

        public CompletableFuture<com.ywt.gapi.nat.GetOrderListResponse> getOrderListAsync(com.ywt.gapi.nat.GetOrderListRequest request){
            return StubInvocationUtil.unaryCall(invoker, getOrderListAsyncMethod, request);
        }

        @Override
        public void getOrderList(com.ywt.gapi.nat.GetOrderListRequest request, StreamObserver<com.ywt.gapi.nat.GetOrderListResponse> responseObserver){
            StubInvocationUtil.unaryCall(invoker, getOrderListMethod , request, responseObserver);
        }
        @Override
        public com.ywt.gapi.nat.PayCallbackResponse payCallback(com.ywt.gapi.nat.PayCallbackRequest request){
            return StubInvocationUtil.unaryCall(invoker, payCallbackMethod, request);
        }

        public CompletableFuture<com.ywt.gapi.nat.PayCallbackResponse> payCallbackAsync(com.ywt.gapi.nat.PayCallbackRequest request){
            return StubInvocationUtil.unaryCall(invoker, payCallbackAsyncMethod, request);
        }

        @Override
        public void payCallback(com.ywt.gapi.nat.PayCallbackRequest request, StreamObserver<com.ywt.gapi.nat.PayCallbackResponse> responseObserver){
            StubInvocationUtil.unaryCall(invoker, payCallbackMethod , request, responseObserver);
        }
            /**
         * <pre>
         *  预约日期，yyyy-MM-dd
         * </pre>
         */
        @Override
        public com.ywt.gapi.nat.RefundNatOrderCallbackResponse refundNatOrderCallback(com.ywt.gapi.nat.RefundNatOrderCallbackRequest request){
            return StubInvocationUtil.unaryCall(invoker, refundNatOrderCallbackMethod, request);
        }

        public CompletableFuture<com.ywt.gapi.nat.RefundNatOrderCallbackResponse> refundNatOrderCallbackAsync(com.ywt.gapi.nat.RefundNatOrderCallbackRequest request){
            return StubInvocationUtil.unaryCall(invoker, refundNatOrderCallbackAsyncMethod, request);
        }

            /**
         * <pre>
         *  预约日期，yyyy-MM-dd
         * </pre>
         */
        @Override
        public void refundNatOrderCallback(com.ywt.gapi.nat.RefundNatOrderCallbackRequest request, StreamObserver<com.ywt.gapi.nat.RefundNatOrderCallbackResponse> responseObserver){
            StubInvocationUtil.unaryCall(invoker, refundNatOrderCallbackMethod , request, responseObserver);
        }
            /**
         * <pre>
         *  预约时间段：1-上午；2-下午；
         * </pre>
         */
        @Override
        public com.ywt.gapi.nat.BaseInfoResponse refund(com.ywt.gapi.nat.RefundOrderRequest request){
            return StubInvocationUtil.unaryCall(invoker, refundMethod, request);
        }

        public CompletableFuture<com.ywt.gapi.nat.BaseInfoResponse> refundAsync(com.ywt.gapi.nat.RefundOrderRequest request){
            return StubInvocationUtil.unaryCall(invoker, refundAsyncMethod, request);
        }

            /**
         * <pre>
         *  预约时间段：1-上午；2-下午；
         * </pre>
         */
        @Override
        public void refund(com.ywt.gapi.nat.RefundOrderRequest request, StreamObserver<com.ywt.gapi.nat.BaseInfoResponse> responseObserver){
            StubInvocationUtil.unaryCall(invoker, refundMethod , request, responseObserver);
        }
            /**
         * <pre>
         *  现住址
         * </pre>
         */
        @Override
        public com.ywt.gapi.nat.BaseInfoResponse cancelOrder(com.ywt.gapi.nat.CancelOrderRequest request){
            return StubInvocationUtil.unaryCall(invoker, cancelOrderMethod, request);
        }

        public CompletableFuture<com.ywt.gapi.nat.BaseInfoResponse> cancelOrderAsync(com.ywt.gapi.nat.CancelOrderRequest request){
            return StubInvocationUtil.unaryCall(invoker, cancelOrderAsyncMethod, request);
        }

            /**
         * <pre>
         *  现住址
         * </pre>
         */
        @Override
        public void cancelOrder(com.ywt.gapi.nat.CancelOrderRequest request, StreamObserver<com.ywt.gapi.nat.BaseInfoResponse> responseObserver){
            StubInvocationUtil.unaryCall(invoker, cancelOrderMethod , request, responseObserver);
        }



    }

    public static abstract class NatServiceImplBase implements NatService, ServerService<NatService> {

        private <T, R> BiConsumer<T, StreamObserver<R>> syncToAsync(java.util.function.Function<T, R> syncFun) {
            return new BiConsumer<T, StreamObserver<R>>() {
                @Override
                public void accept(T t, StreamObserver<R> observer) {
                    try {
                        R ret = syncFun.apply(t);
                        observer.onNext(ret);
                        observer.onCompleted();
                    } catch (Throwable e) {
                        observer.onError(e);
                    }
                }
            };
        }

        @Override
        public final Invoker<NatService> getInvoker(URL url) {
            PathResolver pathResolver = url.getOrDefaultFrameworkModel()
            .getExtensionLoader(PathResolver.class)
            .getDefaultExtension();
            Map<String,StubMethodHandler<?, ?>> handlers = new HashMap<>();

            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/createOrder" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/createOrderAsync" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/getConfig" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/getConfigAsync" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/getOrderDetail" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/getOrderDetailAsync" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/getOrderList" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/getOrderListAsync" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/payCallback" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/payCallbackAsync" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/refundNatOrderCallback" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/refundNatOrderCallbackAsync" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/refund" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/refundAsync" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/cancelOrder" );
            pathResolver.addNativeStub( "/" + SERVICE_NAME + "/cancelOrderAsync" );

            BiConsumer<com.ywt.gapi.nat.CreateOrderRequest, StreamObserver<com.ywt.gapi.nat.CreateOrderResponse>> createOrderFunc = this::createOrder;
            handlers.put(createOrderMethod.getMethodName(), new UnaryStubMethodHandler<>(createOrderFunc));
            BiConsumer<com.ywt.gapi.nat.CreateOrderRequest, StreamObserver<com.ywt.gapi.nat.CreateOrderResponse>> createOrderAsyncFunc = syncToAsync(this::createOrder);
            handlers.put(createOrderProxyAsyncMethod.getMethodName(), new UnaryStubMethodHandler<>(createOrderAsyncFunc));
            BiConsumer<com.ywt.gapi.nat.GetConfigRequest, StreamObserver<com.ywt.gapi.nat.GetConfigResponse>> getConfigFunc = this::getConfig;
            handlers.put(getConfigMethod.getMethodName(), new UnaryStubMethodHandler<>(getConfigFunc));
            BiConsumer<com.ywt.gapi.nat.GetConfigRequest, StreamObserver<com.ywt.gapi.nat.GetConfigResponse>> getConfigAsyncFunc = syncToAsync(this::getConfig);
            handlers.put(getConfigProxyAsyncMethod.getMethodName(), new UnaryStubMethodHandler<>(getConfigAsyncFunc));
            BiConsumer<com.ywt.gapi.nat.GetOrderDetailRequest, StreamObserver<com.ywt.gapi.nat.GetOrderDetailResponse>> getOrderDetailFunc = this::getOrderDetail;
            handlers.put(getOrderDetailMethod.getMethodName(), new UnaryStubMethodHandler<>(getOrderDetailFunc));
            BiConsumer<com.ywt.gapi.nat.GetOrderDetailRequest, StreamObserver<com.ywt.gapi.nat.GetOrderDetailResponse>> getOrderDetailAsyncFunc = syncToAsync(this::getOrderDetail);
            handlers.put(getOrderDetailProxyAsyncMethod.getMethodName(), new UnaryStubMethodHandler<>(getOrderDetailAsyncFunc));
            BiConsumer<com.ywt.gapi.nat.GetOrderListRequest, StreamObserver<com.ywt.gapi.nat.GetOrderListResponse>> getOrderListFunc = this::getOrderList;
            handlers.put(getOrderListMethod.getMethodName(), new UnaryStubMethodHandler<>(getOrderListFunc));
            BiConsumer<com.ywt.gapi.nat.GetOrderListRequest, StreamObserver<com.ywt.gapi.nat.GetOrderListResponse>> getOrderListAsyncFunc = syncToAsync(this::getOrderList);
            handlers.put(getOrderListProxyAsyncMethod.getMethodName(), new UnaryStubMethodHandler<>(getOrderListAsyncFunc));
            BiConsumer<com.ywt.gapi.nat.PayCallbackRequest, StreamObserver<com.ywt.gapi.nat.PayCallbackResponse>> payCallbackFunc = this::payCallback;
            handlers.put(payCallbackMethod.getMethodName(), new UnaryStubMethodHandler<>(payCallbackFunc));
            BiConsumer<com.ywt.gapi.nat.PayCallbackRequest, StreamObserver<com.ywt.gapi.nat.PayCallbackResponse>> payCallbackAsyncFunc = syncToAsync(this::payCallback);
            handlers.put(payCallbackProxyAsyncMethod.getMethodName(), new UnaryStubMethodHandler<>(payCallbackAsyncFunc));
            BiConsumer<com.ywt.gapi.nat.RefundNatOrderCallbackRequest, StreamObserver<com.ywt.gapi.nat.RefundNatOrderCallbackResponse>> refundNatOrderCallbackFunc = this::refundNatOrderCallback;
            handlers.put(refundNatOrderCallbackMethod.getMethodName(), new UnaryStubMethodHandler<>(refundNatOrderCallbackFunc));
            BiConsumer<com.ywt.gapi.nat.RefundNatOrderCallbackRequest, StreamObserver<com.ywt.gapi.nat.RefundNatOrderCallbackResponse>> refundNatOrderCallbackAsyncFunc = syncToAsync(this::refundNatOrderCallback);
            handlers.put(refundNatOrderCallbackProxyAsyncMethod.getMethodName(), new UnaryStubMethodHandler<>(refundNatOrderCallbackAsyncFunc));
            BiConsumer<com.ywt.gapi.nat.RefundOrderRequest, StreamObserver<com.ywt.gapi.nat.BaseInfoResponse>> refundFunc = this::refund;
            handlers.put(refundMethod.getMethodName(), new UnaryStubMethodHandler<>(refundFunc));
            BiConsumer<com.ywt.gapi.nat.RefundOrderRequest, StreamObserver<com.ywt.gapi.nat.BaseInfoResponse>> refundAsyncFunc = syncToAsync(this::refund);
            handlers.put(refundProxyAsyncMethod.getMethodName(), new UnaryStubMethodHandler<>(refundAsyncFunc));
            BiConsumer<com.ywt.gapi.nat.CancelOrderRequest, StreamObserver<com.ywt.gapi.nat.BaseInfoResponse>> cancelOrderFunc = this::cancelOrder;
            handlers.put(cancelOrderMethod.getMethodName(), new UnaryStubMethodHandler<>(cancelOrderFunc));
            BiConsumer<com.ywt.gapi.nat.CancelOrderRequest, StreamObserver<com.ywt.gapi.nat.BaseInfoResponse>> cancelOrderAsyncFunc = syncToAsync(this::cancelOrder);
            handlers.put(cancelOrderProxyAsyncMethod.getMethodName(), new UnaryStubMethodHandler<>(cancelOrderAsyncFunc));




            return new StubInvoker<>(this, url, NatService.class, handlers);
        }


        @Override
        public com.ywt.gapi.nat.CreateOrderResponse createOrder(com.ywt.gapi.nat.CreateOrderRequest request){
            throw unimplementedMethodException(createOrderMethod);
        }

        @Override
        public com.ywt.gapi.nat.GetConfigResponse getConfig(com.ywt.gapi.nat.GetConfigRequest request){
            throw unimplementedMethodException(getConfigMethod);
        }

        @Override
        public com.ywt.gapi.nat.GetOrderDetailResponse getOrderDetail(com.ywt.gapi.nat.GetOrderDetailRequest request){
            throw unimplementedMethodException(getOrderDetailMethod);
        }

        @Override
        public com.ywt.gapi.nat.GetOrderListResponse getOrderList(com.ywt.gapi.nat.GetOrderListRequest request){
            throw unimplementedMethodException(getOrderListMethod);
        }

        @Override
        public com.ywt.gapi.nat.PayCallbackResponse payCallback(com.ywt.gapi.nat.PayCallbackRequest request){
            throw unimplementedMethodException(payCallbackMethod);
        }

        @Override
        public com.ywt.gapi.nat.RefundNatOrderCallbackResponse refundNatOrderCallback(com.ywt.gapi.nat.RefundNatOrderCallbackRequest request){
            throw unimplementedMethodException(refundNatOrderCallbackMethod);
        }

        @Override
        public com.ywt.gapi.nat.BaseInfoResponse refund(com.ywt.gapi.nat.RefundOrderRequest request){
            throw unimplementedMethodException(refundMethod);
        }

        @Override
        public com.ywt.gapi.nat.BaseInfoResponse cancelOrder(com.ywt.gapi.nat.CancelOrderRequest request){
            throw unimplementedMethodException(cancelOrderMethod);
        }





        @Override
        public final ServiceDescriptor getServiceDescriptor() {
            return serviceDescriptor;
        }
        private RpcException unimplementedMethodException(StubMethodDescriptor methodDescriptor) {
            return TriRpcStatus.UNIMPLEMENTED.withDescription(String.format("Method %s is unimplemented",
                "/" + serviceDescriptor.getInterfaceName() + "/" + methodDescriptor.getMethodName())).asException();
        }
    }

}
