/*
* 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.im;

import org.apache.dubbo.common.stream.StreamObserver;
import com.google.protobuf.Message;

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

public interface IMService extends org.apache.dubbo.rpc.model.DubboStub {

    String JAVA_SERVICE_NAME = "com.ywt.gapi.im.IMService";
    String SERVICE_NAME = "com.ywt.gapi.im.IMService";

    com.ywt.gapi.im.SendResponse sendNoticeMessage(com.ywt.gapi.im.NoticeMessage request);

    default CompletableFuture<com.ywt.gapi.im.SendResponse> sendNoticeMessageAsync(com.ywt.gapi.im.NoticeMessage request){
        return CompletableFuture.completedFuture(sendNoticeMessage(request));
    }

    /**
    * This server stream type unary method is <b>only</b> used for generated stub to support async unary method.
    * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method.
    */
    default void sendNoticeMessage(com.ywt.gapi.im.NoticeMessage request, StreamObserver<com.ywt.gapi.im.SendResponse> responseObserver){
        sendNoticeMessageAsync(request).whenComplete((r, t) -> {
            if (t != null) {
                responseObserver.onError(t);
            } else {
                responseObserver.onNext(r);
                responseObserver.onCompleted();
            }
        });
    }

    com.ywt.gapi.im.SendResponse sendSessionMessage(com.ywt.gapi.im.SessionMessage request);

    default CompletableFuture<com.ywt.gapi.im.SendResponse> sendSessionMessageAsync(com.ywt.gapi.im.SessionMessage request){
        return CompletableFuture.completedFuture(sendSessionMessage(request));
    }

    /**
    * This server stream type unary method is <b>only</b> used for generated stub to support async unary method.
    * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method.
    */
    default void sendSessionMessage(com.ywt.gapi.im.SessionMessage request, StreamObserver<com.ywt.gapi.im.SendResponse> responseObserver){
        sendSessionMessageAsync(request).whenComplete((r, t) -> {
            if (t != null) {
                responseObserver.onError(t);
            } else {
                responseObserver.onNext(r);
                responseObserver.onCompleted();
            }
        });
    }

    com.ywt.gapi.im.SessionMessageRecordResponse pullSessionMessageRecord(com.ywt.gapi.im.PullSessionMessageRecordRequest request);

    default CompletableFuture<com.ywt.gapi.im.SessionMessageRecordResponse> pullSessionMessageRecordAsync(com.ywt.gapi.im.PullSessionMessageRecordRequest request){
        return CompletableFuture.completedFuture(pullSessionMessageRecord(request));
    }

    /**
    * This server stream type unary method is <b>only</b> used for generated stub to support async unary method.
    * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method.
    */
    default void pullSessionMessageRecord(com.ywt.gapi.im.PullSessionMessageRecordRequest request, StreamObserver<com.ywt.gapi.im.SessionMessageRecordResponse> responseObserver){
        pullSessionMessageRecordAsync(request).whenComplete((r, t) -> {
            if (t != null) {
                responseObserver.onError(t);
            } else {
                responseObserver.onNext(r);
                responseObserver.onCompleted();
            }
        });
    }

    com.ywt.gapi.im.NoticeMessageResponse pullNoticeMessage(com.ywt.gapi.im.PullNoticeMessageRequest request);

    default CompletableFuture<com.ywt.gapi.im.NoticeMessageResponse> pullNoticeMessageAsync(com.ywt.gapi.im.PullNoticeMessageRequest request){
        return CompletableFuture.completedFuture(pullNoticeMessage(request));
    }

    /**
    * This server stream type unary method is <b>only</b> used for generated stub to support async unary method.
    * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method.
    */
    default void pullNoticeMessage(com.ywt.gapi.im.PullNoticeMessageRequest request, StreamObserver<com.ywt.gapi.im.NoticeMessageResponse> responseObserver){
        pullNoticeMessageAsync(request).whenComplete((r, t) -> {
            if (t != null) {
                responseObserver.onError(t);
            } else {
                responseObserver.onNext(r);
                responseObserver.onCompleted();
            }
        });
    }

    com.ywt.gapi.im.IssueTokenResponse issueToken(com.ywt.gapi.im.IssueTokenRequest request);

    default CompletableFuture<com.ywt.gapi.im.IssueTokenResponse> issueTokenAsync(com.ywt.gapi.im.IssueTokenRequest request){
        return CompletableFuture.completedFuture(issueToken(request));
    }

    /**
    * This server stream type unary method is <b>only</b> used for generated stub to support async unary method.
    * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method.
    */
    default void issueToken(com.ywt.gapi.im.IssueTokenRequest request, StreamObserver<com.ywt.gapi.im.IssueTokenResponse> responseObserver){
        issueTokenAsync(request).whenComplete((r, t) -> {
            if (t != null) {
                responseObserver.onError(t);
            } else {
                responseObserver.onNext(r);
                responseObserver.onCompleted();
            }
        });
    }

    com.ywt.gapi.im.CheckTokenResponse checkToken(com.ywt.gapi.im.CheckTokenRequest request);

    default CompletableFuture<com.ywt.gapi.im.CheckTokenResponse> checkTokenAsync(com.ywt.gapi.im.CheckTokenRequest request){
        return CompletableFuture.completedFuture(checkToken(request));
    }

    /**
    * This server stream type unary method is <b>only</b> used for generated stub to support async unary method.
    * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method.
    */
    default void checkToken(com.ywt.gapi.im.CheckTokenRequest request, StreamObserver<com.ywt.gapi.im.CheckTokenResponse> responseObserver){
        checkTokenAsync(request).whenComplete((r, t) -> {
            if (t != null) {
                responseObserver.onError(t);
            } else {
                responseObserver.onNext(r);
                responseObserver.onCompleted();
            }
        });
    }

    com.ywt.gapi.im.SaveSessionMessageResponse saveSessionMessage(com.ywt.gapi.im.SaveSessionMessageRequest request);

    default CompletableFuture<com.ywt.gapi.im.SaveSessionMessageResponse> saveSessionMessageAsync(com.ywt.gapi.im.SaveSessionMessageRequest request){
        return CompletableFuture.completedFuture(saveSessionMessage(request));
    }

    /**
    * This server stream type unary method is <b>only</b> used for generated stub to support async unary method.
    * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method.
    */
    default void saveSessionMessage(com.ywt.gapi.im.SaveSessionMessageRequest request, StreamObserver<com.ywt.gapi.im.SaveSessionMessageResponse> responseObserver){
        saveSessionMessageAsync(request).whenComplete((r, t) -> {
            if (t != null) {
                responseObserver.onError(t);
            } else {
                responseObserver.onNext(r);
                responseObserver.onCompleted();
            }
        });
    }

        /**
         * <pre>
         * 消息类型：1 文本消息 2 图片消息 3 病历消息
         * </pre>
         */
    com.ywt.gapi.im.SaveNoticeMessageResponse saveNoticeMessage(com.ywt.gapi.im.SaveNoticeMessageRequest request);

    default CompletableFuture<com.ywt.gapi.im.SaveNoticeMessageResponse> saveNoticeMessageAsync(com.ywt.gapi.im.SaveNoticeMessageRequest request){
        return CompletableFuture.completedFuture(saveNoticeMessage(request));
    }

    /**
    * This server stream type unary method is <b>only</b> used for generated stub to support async unary method.
    * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method.
    */
    default void saveNoticeMessage(com.ywt.gapi.im.SaveNoticeMessageRequest request, StreamObserver<com.ywt.gapi.im.SaveNoticeMessageResponse> responseObserver){
        saveNoticeMessageAsync(request).whenComplete((r, t) -> {
            if (t != null) {
                responseObserver.onError(t);
            } else {
                responseObserver.onNext(r);
                responseObserver.onCompleted();
            }
        });
    }

    com.ywt.gapi.im.RecallResponse recall(com.ywt.gapi.im.RecallRequest request);

    default CompletableFuture<com.ywt.gapi.im.RecallResponse> recallAsync(com.ywt.gapi.im.RecallRequest request){
        return CompletableFuture.completedFuture(recall(request));
    }

    /**
    * This server stream type unary method is <b>only</b> used for generated stub to support async unary method.
    * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method.
    */
    default void recall(com.ywt.gapi.im.RecallRequest request, StreamObserver<com.ywt.gapi.im.RecallResponse> responseObserver){
        recallAsync(request).whenComplete((r, t) -> {
            if (t != null) {
                responseObserver.onError(t);
            } else {
                responseObserver.onNext(r);
                responseObserver.onCompleted();
            }
        });
    }

    com.ywt.gapi.im.SessionCountResponse sessionCount(com.ywt.gapi.im.SessionCountRequest request);

    default CompletableFuture<com.ywt.gapi.im.SessionCountResponse> sessionCountAsync(com.ywt.gapi.im.SessionCountRequest request){
        return CompletableFuture.completedFuture(sessionCount(request));
    }

    /**
    * This server stream type unary method is <b>only</b> used for generated stub to support async unary method.
    * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method.
    */
    default void sessionCount(com.ywt.gapi.im.SessionCountRequest request, StreamObserver<com.ywt.gapi.im.SessionCountResponse> responseObserver){
        sessionCountAsync(request).whenComplete((r, t) -> {
            if (t != null) {
                responseObserver.onError(t);
            } else {
                responseObserver.onNext(r);
                responseObserver.onCompleted();
            }
        });
    }

    com.ywt.gapi.im.GetChatsResponse getChats(com.ywt.gapi.im.GetChatsRequest request);

    default CompletableFuture<com.ywt.gapi.im.GetChatsResponse> getChatsAsync(com.ywt.gapi.im.GetChatsRequest request){
        return CompletableFuture.completedFuture(getChats(request));
    }

    /**
    * This server stream type unary method is <b>only</b> used for generated stub to support async unary method.
    * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method.
    */
    default void getChats(com.ywt.gapi.im.GetChatsRequest request, StreamObserver<com.ywt.gapi.im.GetChatsResponse> responseObserver){
        getChatsAsync(request).whenComplete((r, t) -> {
            if (t != null) {
                responseObserver.onError(t);
            } else {
                responseObserver.onNext(r);
                responseObserver.onCompleted();
            }
        });
    }

    com.ywt.gapi.im.SendResponse notifyNewPublishForDoc(com.ywt.gapi.im.NotifyNewPublishForDocRequest request);

    default CompletableFuture<com.ywt.gapi.im.SendResponse> notifyNewPublishForDocAsync(com.ywt.gapi.im.NotifyNewPublishForDocRequest request){
        return CompletableFuture.completedFuture(notifyNewPublishForDoc(request));
    }

    /**
    * This server stream type unary method is <b>only</b> used for generated stub to support async unary method.
    * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method.
    */
    default void notifyNewPublishForDoc(com.ywt.gapi.im.NotifyNewPublishForDocRequest request, StreamObserver<com.ywt.gapi.im.SendResponse> responseObserver){
        notifyNewPublishForDocAsync(request).whenComplete((r, t) -> {
            if (t != null) {
                responseObserver.onError(t);
            } else {
                responseObserver.onNext(r);
                responseObserver.onCompleted();
            }
        });
    }

    com.ywt.gapi.im.UpdateMsgResponse updateSessionMsg(com.ywt.gapi.im.UpdateMsgRequest request);

    default CompletableFuture<com.ywt.gapi.im.UpdateMsgResponse> updateSessionMsgAsync(com.ywt.gapi.im.UpdateMsgRequest request){
        return CompletableFuture.completedFuture(updateSessionMsg(request));
    }

    /**
    * This server stream type unary method is <b>only</b> used for generated stub to support async unary method.
    * It will not be called if you are NOT using Dubbo3 generated triple stub and <b>DO NOT</b> implement this method.
    */
    default void updateSessionMsg(com.ywt.gapi.im.UpdateMsgRequest request, StreamObserver<com.ywt.gapi.im.UpdateMsgResponse> responseObserver){
        updateSessionMsgAsync(request).whenComplete((r, t) -> {
            if (t != null) {
                responseObserver.onError(t);
            } else {
                responseObserver.onNext(r);
                responseObserver.onCompleted();
            }
        });
    }






}
