// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             v6.30.1
// source: question.proto

package survey

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9

const (
	Question_Add_FullMethodName      = "/survey.Question/Add"
	Question_Update_FullMethodName   = "/survey.Question/Update"
	Question_Delete_FullMethodName   = "/survey.Question/Delete"
	Question_Fetch_FullMethodName    = "/survey.Question/Fetch"
	Question_BySurvey_FullMethodName = "/survey.Question/BySurvey"
)

// QuestionClient is the client API for Question service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// 问卷服务 - 问题管理
type QuestionClient interface {
	Add(ctx context.Context, in *QuestionItem, opts ...grpc.CallOption) (*StatusReply, error)
	Update(ctx context.Context, in *QuestionItem, opts ...grpc.CallOption) (*StatusReply, error)
	Delete(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
	Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*ListQuestionReply, error)
	BySurvey(ctx context.Context, in *BySurveyRequest, opts ...grpc.CallOption) (*ListQuestionReply, error)
}

type questionClient struct {
	cc grpc.ClientConnInterface
}

func NewQuestionClient(cc grpc.ClientConnInterface) QuestionClient {
	return &questionClient{cc}
}

func (c *questionClient) Add(ctx context.Context, in *QuestionItem, opts ...grpc.CallOption) (*StatusReply, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(StatusReply)
	err := c.cc.Invoke(ctx, Question_Add_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *questionClient) Update(ctx context.Context, in *QuestionItem, opts ...grpc.CallOption) (*StatusReply, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(StatusReply)
	err := c.cc.Invoke(ctx, Question_Update_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *questionClient) Delete(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(StatusReply)
	err := c.cc.Invoke(ctx, Question_Delete_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *questionClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*ListQuestionReply, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ListQuestionReply)
	err := c.cc.Invoke(ctx, Question_Fetch_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *questionClient) BySurvey(ctx context.Context, in *BySurveyRequest, opts ...grpc.CallOption) (*ListQuestionReply, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ListQuestionReply)
	err := c.cc.Invoke(ctx, Question_BySurvey_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// QuestionServer is the server API for Question service.
// All implementations must embed UnimplementedQuestionServer
// for forward compatibility.
//
// 问卷服务 - 问题管理
type QuestionServer interface {
	Add(context.Context, *QuestionItem) (*StatusReply, error)
	Update(context.Context, *QuestionItem) (*StatusReply, error)
	Delete(context.Context, *IdentRequest) (*StatusReply, error)
	Fetch(context.Context, *FetchRequest) (*ListQuestionReply, error)
	BySurvey(context.Context, *BySurveyRequest) (*ListQuestionReply, error)
	mustEmbedUnimplementedQuestionServer()
}

// UnimplementedQuestionServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedQuestionServer struct{}

func (UnimplementedQuestionServer) Add(context.Context, *QuestionItem) (*StatusReply, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Add not implemented")
}
func (UnimplementedQuestionServer) Update(context.Context, *QuestionItem) (*StatusReply, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Update not implemented")
}
func (UnimplementedQuestionServer) Delete(context.Context, *IdentRequest) (*StatusReply, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
}
func (UnimplementedQuestionServer) Fetch(context.Context, *FetchRequest) (*ListQuestionReply, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Fetch not implemented")
}
func (UnimplementedQuestionServer) BySurvey(context.Context, *BySurveyRequest) (*ListQuestionReply, error) {
	return nil, status.Errorf(codes.Unimplemented, "method BySurvey not implemented")
}
func (UnimplementedQuestionServer) mustEmbedUnimplementedQuestionServer() {}
func (UnimplementedQuestionServer) testEmbeddedByValue()                  {}

// UnsafeQuestionServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QuestionServer will
// result in compilation errors.
type UnsafeQuestionServer interface {
	mustEmbedUnimplementedQuestionServer()
}

func RegisterQuestionServer(s grpc.ServiceRegistrar, srv QuestionServer) {
	// If the following call pancis, it indicates UnimplementedQuestionServer was
	// embedded by pointer and is nil.  This will cause panics if an
	// unimplemented method is ever invoked, so we test this at initialization
	// time to prevent it from happening at runtime later due to I/O.
	if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
		t.testEmbeddedByValue()
	}
	s.RegisterService(&Question_ServiceDesc, srv)
}

func _Question_Add_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(QuestionItem)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(QuestionServer).Add(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Question_Add_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(QuestionServer).Add(ctx, req.(*QuestionItem))
	}
	return interceptor(ctx, in, info, handler)
}

func _Question_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(QuestionItem)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(QuestionServer).Update(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Question_Update_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(QuestionServer).Update(ctx, req.(*QuestionItem))
	}
	return interceptor(ctx, in, info, handler)
}

func _Question_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(IdentRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(QuestionServer).Delete(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Question_Delete_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(QuestionServer).Delete(ctx, req.(*IdentRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Question_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(FetchRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(QuestionServer).Fetch(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Question_Fetch_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(QuestionServer).Fetch(ctx, req.(*FetchRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Question_BySurvey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(BySurveyRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(QuestionServer).BySurvey(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Question_BySurvey_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(QuestionServer).BySurvey(ctx, req.(*BySurveyRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// Question_ServiceDesc is the grpc.ServiceDesc for Question service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Question_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "survey.Question",
	HandlerType: (*QuestionServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Add",
			Handler:    _Question_Add_Handler,
		},
		{
			MethodName: "Update",
			Handler:    _Question_Update_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _Question_Delete_Handler,
		},
		{
			MethodName: "Fetch",
			Handler:    _Question_Fetch_Handler,
		},
		{
			MethodName: "BySurvey",
			Handler:    _Question_BySurvey_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "question.proto",
}