package ztp;

import static ztp.ZtpServiceGrpc.getServiceDescriptor;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;

@jakarta.annotation.Generated(value = "by Mutiny Grpc generator", comments = "Source: ztp.proto")
public final class MutinyZtpServiceGrpc implements io.quarkus.grpc.MutinyGrpc {

    private MutinyZtpServiceGrpc() {
    }

    public static MutinyZtpServiceStub newMutinyStub(io.grpc.Channel channel) {
        return new MutinyZtpServiceStub(channel);
    }

    public static class MutinyZtpServiceStub extends io.grpc.stub.AbstractStub<MutinyZtpServiceStub> implements io.quarkus.grpc.MutinyStub {

        private ZtpServiceGrpc.ZtpServiceStub delegateStub;

        private MutinyZtpServiceStub(io.grpc.Channel channel) {
            super(channel);
            delegateStub = ZtpServiceGrpc.newStub(channel);
        }

        private MutinyZtpServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
            super(channel, callOptions);
            delegateStub = ZtpServiceGrpc.newStub(channel).build(channel, callOptions);
        }

        @Override
        protected MutinyZtpServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
            return new MutinyZtpServiceStub(channel, callOptions);
        }

        public io.smallrye.mutiny.Uni<ztp.Ztp.DeviceRole> ztpGetDeviceRole(ztp.Ztp.DeviceRoleId request) {
            return io.quarkus.grpc.stubs.ClientCalls.oneToOne(request, delegateStub::ztpGetDeviceRole);
        }

        public io.smallrye.mutiny.Uni<ztp.Ztp.DeviceRoleList> ztpGetDeviceRolesByDeviceId(context.ContextOuterClass.DeviceId request) {
            return io.quarkus.grpc.stubs.ClientCalls.oneToOne(request, delegateStub::ztpGetDeviceRolesByDeviceId);
        }

        public io.smallrye.mutiny.Uni<ztp.Ztp.DeviceRoleState> ztpAdd(ztp.Ztp.DeviceRole request) {
            return io.quarkus.grpc.stubs.ClientCalls.oneToOne(request, delegateStub::ztpAdd);
        }

        public io.smallrye.mutiny.Uni<ztp.Ztp.DeviceRoleState> ztpUpdate(ztp.Ztp.DeviceRoleConfig request) {
            return io.quarkus.grpc.stubs.ClientCalls.oneToOne(request, delegateStub::ztpUpdate);
        }

        public io.smallrye.mutiny.Uni<ztp.Ztp.DeviceRoleState> ztpDelete(ztp.Ztp.DeviceRole request) {
            return io.quarkus.grpc.stubs.ClientCalls.oneToOne(request, delegateStub::ztpDelete);
        }

        public io.smallrye.mutiny.Uni<ztp.Ztp.DeviceDeletionResult> ztpDeleteAll(context.ContextOuterClass.Empty request) {
            return io.quarkus.grpc.stubs.ClientCalls.oneToOne(request, delegateStub::ztpDeleteAll);
        }
    }

    public static abstract class ZtpServiceImplBase implements io.grpc.BindableService {

        private String compression;

        /**
         * Set whether the server will try to use a compressed response.
         *
         * @param compression the compression, e.g {@code gzip}
         */
        public ZtpServiceImplBase withCompression(String compression) {
            this.compression = compression;
            return this;
        }

        public io.smallrye.mutiny.Uni<ztp.Ztp.DeviceRole> ztpGetDeviceRole(ztp.Ztp.DeviceRoleId request) {
            throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
        }

        public io.smallrye.mutiny.Uni<ztp.Ztp.DeviceRoleList> ztpGetDeviceRolesByDeviceId(context.ContextOuterClass.DeviceId request) {
            throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
        }

        public io.smallrye.mutiny.Uni<ztp.Ztp.DeviceRoleState> ztpAdd(ztp.Ztp.DeviceRole request) {
            throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
        }

        public io.smallrye.mutiny.Uni<ztp.Ztp.DeviceRoleState> ztpUpdate(ztp.Ztp.DeviceRoleConfig request) {
            throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
        }

        public io.smallrye.mutiny.Uni<ztp.Ztp.DeviceRoleState> ztpDelete(ztp.Ztp.DeviceRole request) {
            throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
        }

        public io.smallrye.mutiny.Uni<ztp.Ztp.DeviceDeletionResult> ztpDeleteAll(context.ContextOuterClass.Empty request) {
            throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
        }

        @java.lang.Override
        public io.grpc.ServerServiceDefinition bindService() {
            return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()).addMethod(ztp.ZtpServiceGrpc.getZtpGetDeviceRoleMethod(), asyncUnaryCall(new MethodHandlers<ztp.Ztp.DeviceRoleId, ztp.Ztp.DeviceRole>(this, METHODID_ZTP_GET_DEVICE_ROLE, compression))).addMethod(ztp.ZtpServiceGrpc.getZtpGetDeviceRolesByDeviceIdMethod(), asyncUnaryCall(new MethodHandlers<context.ContextOuterClass.DeviceId, ztp.Ztp.DeviceRoleList>(this, METHODID_ZTP_GET_DEVICE_ROLES_BY_DEVICE_ID, compression))).addMethod(ztp.ZtpServiceGrpc.getZtpAddMethod(), asyncUnaryCall(new MethodHandlers<ztp.Ztp.DeviceRole, ztp.Ztp.DeviceRoleState>(this, METHODID_ZTP_ADD, compression))).addMethod(ztp.ZtpServiceGrpc.getZtpUpdateMethod(), asyncUnaryCall(new MethodHandlers<ztp.Ztp.DeviceRoleConfig, ztp.Ztp.DeviceRoleState>(this, METHODID_ZTP_UPDATE, compression))).addMethod(ztp.ZtpServiceGrpc.getZtpDeleteMethod(), asyncUnaryCall(new MethodHandlers<ztp.Ztp.DeviceRole, ztp.Ztp.DeviceRoleState>(this, METHODID_ZTP_DELETE, compression))).addMethod(ztp.ZtpServiceGrpc.getZtpDeleteAllMethod(), asyncUnaryCall(new MethodHandlers<context.ContextOuterClass.Empty, ztp.Ztp.DeviceDeletionResult>(this, METHODID_ZTP_DELETE_ALL, compression))).build();
        }
    }

    private static final int METHODID_ZTP_GET_DEVICE_ROLE = 0;

    private static final int METHODID_ZTP_GET_DEVICE_ROLES_BY_DEVICE_ID = 1;

    private static final int METHODID_ZTP_ADD = 2;

    private static final int METHODID_ZTP_UPDATE = 3;

    private static final int METHODID_ZTP_DELETE = 4;

    private static final int METHODID_ZTP_DELETE_ALL = 5;

    private static final class MethodHandlers<Req, Resp> implements io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>, io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>, io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>, io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {

        private final ZtpServiceImplBase serviceImpl;

        private final int methodId;

        private final String compression;

        MethodHandlers(ZtpServiceImplBase serviceImpl, int methodId, String compression) {
            this.serviceImpl = serviceImpl;
            this.methodId = methodId;
            this.compression = compression;
        }

        @java.lang.Override
        @java.lang.SuppressWarnings("unchecked")
        public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
            switch(methodId) {
                case METHODID_ZTP_GET_DEVICE_ROLE:
                    io.quarkus.grpc.stubs.ServerCalls.oneToOne((ztp.Ztp.DeviceRoleId) request, (io.grpc.stub.StreamObserver<ztp.Ztp.DeviceRole>) responseObserver, compression, serviceImpl::ztpGetDeviceRole);
                    break;
                case METHODID_ZTP_GET_DEVICE_ROLES_BY_DEVICE_ID:
                    io.quarkus.grpc.stubs.ServerCalls.oneToOne((context.ContextOuterClass.DeviceId) request, (io.grpc.stub.StreamObserver<ztp.Ztp.DeviceRoleList>) responseObserver, compression, serviceImpl::ztpGetDeviceRolesByDeviceId);
                    break;
                case METHODID_ZTP_ADD:
                    io.quarkus.grpc.stubs.ServerCalls.oneToOne((ztp.Ztp.DeviceRole) request, (io.grpc.stub.StreamObserver<ztp.Ztp.DeviceRoleState>) responseObserver, compression, serviceImpl::ztpAdd);
                    break;
                case METHODID_ZTP_UPDATE:
                    io.quarkus.grpc.stubs.ServerCalls.oneToOne((ztp.Ztp.DeviceRoleConfig) request, (io.grpc.stub.StreamObserver<ztp.Ztp.DeviceRoleState>) responseObserver, compression, serviceImpl::ztpUpdate);
                    break;
                case METHODID_ZTP_DELETE:
                    io.quarkus.grpc.stubs.ServerCalls.oneToOne((ztp.Ztp.DeviceRole) request, (io.grpc.stub.StreamObserver<ztp.Ztp.DeviceRoleState>) responseObserver, compression, serviceImpl::ztpDelete);
                    break;
                case METHODID_ZTP_DELETE_ALL:
                    io.quarkus.grpc.stubs.ServerCalls.oneToOne((context.ContextOuterClass.Empty) request, (io.grpc.stub.StreamObserver<ztp.Ztp.DeviceDeletionResult>) responseObserver, compression, serviceImpl::ztpDeleteAll);
                    break;
                default:
                    throw new java.lang.AssertionError();
            }
        }

        @java.lang.Override
        @java.lang.SuppressWarnings("unchecked")
        public io.grpc.stub.StreamObserver<Req> invoke(io.grpc.stub.StreamObserver<Resp> responseObserver) {
            switch(methodId) {
                default:
                    throw new java.lang.AssertionError();
            }
        }
    }
}
