// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             v5.28.0
// source: extension.proto

package hiddifyrpc

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 (
	ExtensionHostService_ListExtensions_FullMethodName = "/hiddifyrpc.ExtensionHostService/ListExtensions"
	ExtensionHostService_Connect_FullMethodName        = "/hiddifyrpc.ExtensionHostService/Connect"
	ExtensionHostService_EditExtension_FullMethodName  = "/hiddifyrpc.ExtensionHostService/EditExtension"
	ExtensionHostService_SubmitForm_FullMethodName     = "/hiddifyrpc.ExtensionHostService/SubmitForm"
	ExtensionHostService_Close_FullMethodName          = "/hiddifyrpc.ExtensionHostService/Close"
	ExtensionHostService_GetUI_FullMethodName          = "/hiddifyrpc.ExtensionHostService/GetUI"
)

// ExtensionHostServiceClient is the client API for ExtensionHostService 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 ExtensionHostServiceClient interface {
	ListExtensions(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ExtensionList, error)
	Connect(ctx context.Context, in *ExtensionRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ExtensionResponse], error)
	EditExtension(ctx context.Context, in *EditExtensionRequest, opts ...grpc.CallOption) (*ExtensionActionResult, error)
	SubmitForm(ctx context.Context, in *SendExtensionDataRequest, opts ...grpc.CallOption) (*ExtensionActionResult, error)
	Close(ctx context.Context, in *ExtensionRequest, opts ...grpc.CallOption) (*ExtensionActionResult, error)
	GetUI(ctx context.Context, in *ExtensionRequest, opts ...grpc.CallOption) (*ExtensionActionResult, error)
}

type extensionHostServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewExtensionHostServiceClient(cc grpc.ClientConnInterface) ExtensionHostServiceClient {
	return &extensionHostServiceClient{cc}
}

func (c *extensionHostServiceClient) ListExtensions(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ExtensionList, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ExtensionList)
	err := c.cc.Invoke(ctx, ExtensionHostService_ListExtensions_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *extensionHostServiceClient) Connect(ctx context.Context, in *ExtensionRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ExtensionResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &ExtensionHostService_ServiceDesc.Streams[0], ExtensionHostService_Connect_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[ExtensionRequest, ExtensionResponse]{ClientStream: stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type ExtensionHostService_ConnectClient = grpc.ServerStreamingClient[ExtensionResponse]

func (c *extensionHostServiceClient) EditExtension(ctx context.Context, in *EditExtensionRequest, opts ...grpc.CallOption) (*ExtensionActionResult, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ExtensionActionResult)
	err := c.cc.Invoke(ctx, ExtensionHostService_EditExtension_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *extensionHostServiceClient) SubmitForm(ctx context.Context, in *SendExtensionDataRequest, opts ...grpc.CallOption) (*ExtensionActionResult, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ExtensionActionResult)
	err := c.cc.Invoke(ctx, ExtensionHostService_SubmitForm_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *extensionHostServiceClient) Close(ctx context.Context, in *ExtensionRequest, opts ...grpc.CallOption) (*ExtensionActionResult, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ExtensionActionResult)
	err := c.cc.Invoke(ctx, ExtensionHostService_Close_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *extensionHostServiceClient) GetUI(ctx context.Context, in *ExtensionRequest, opts ...grpc.CallOption) (*ExtensionActionResult, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ExtensionActionResult)
	err := c.cc.Invoke(ctx, ExtensionHostService_GetUI_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// ExtensionHostServiceServer is the server API for ExtensionHostService service.
// All implementations must embed UnimplementedExtensionHostServiceServer
// for forward compatibility.
type ExtensionHostServiceServer interface {
	ListExtensions(context.Context, *Empty) (*ExtensionList, error)
	Connect(*ExtensionRequest, grpc.ServerStreamingServer[ExtensionResponse]) error
	EditExtension(context.Context, *EditExtensionRequest) (*ExtensionActionResult, error)
	SubmitForm(context.Context, *SendExtensionDataRequest) (*ExtensionActionResult, error)
	Close(context.Context, *ExtensionRequest) (*ExtensionActionResult, error)
	GetUI(context.Context, *ExtensionRequest) (*ExtensionActionResult, error)
	mustEmbedUnimplementedExtensionHostServiceServer()
}

// UnimplementedExtensionHostServiceServer 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 UnimplementedExtensionHostServiceServer struct{}

func (UnimplementedExtensionHostServiceServer) ListExtensions(context.Context, *Empty) (*ExtensionList, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ListExtensions not implemented")
}
func (UnimplementedExtensionHostServiceServer) Connect(*ExtensionRequest, grpc.ServerStreamingServer[ExtensionResponse]) error {
	return status.Errorf(codes.Unimplemented, "method Connect not implemented")
}
func (UnimplementedExtensionHostServiceServer) EditExtension(context.Context, *EditExtensionRequest) (*ExtensionActionResult, error) {
	return nil, status.Errorf(codes.Unimplemented, "method EditExtension not implemented")
}
func (UnimplementedExtensionHostServiceServer) SubmitForm(context.Context, *SendExtensionDataRequest) (*ExtensionActionResult, error) {
	return nil, status.Errorf(codes.Unimplemented, "method SubmitForm not implemented")
}
func (UnimplementedExtensionHostServiceServer) Close(context.Context, *ExtensionRequest) (*ExtensionActionResult, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Close not implemented")
}
func (UnimplementedExtensionHostServiceServer) GetUI(context.Context, *ExtensionRequest) (*ExtensionActionResult, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetUI not implemented")
}
func (UnimplementedExtensionHostServiceServer) mustEmbedUnimplementedExtensionHostServiceServer() {}
func (UnimplementedExtensionHostServiceServer) testEmbeddedByValue()                              {}

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

func RegisterExtensionHostServiceServer(s grpc.ServiceRegistrar, srv ExtensionHostServiceServer) {
	// If the following call pancis, it indicates UnimplementedExtensionHostServiceServer 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(&ExtensionHostService_ServiceDesc, srv)
}

func _ExtensionHostService_ListExtensions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ExtensionHostServiceServer).ListExtensions(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: ExtensionHostService_ListExtensions_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ExtensionHostServiceServer).ListExtensions(ctx, req.(*Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _ExtensionHostService_Connect_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(ExtensionRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(ExtensionHostServiceServer).Connect(m, &grpc.GenericServerStream[ExtensionRequest, ExtensionResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type ExtensionHostService_ConnectServer = grpc.ServerStreamingServer[ExtensionResponse]

func _ExtensionHostService_EditExtension_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(EditExtensionRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ExtensionHostServiceServer).EditExtension(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: ExtensionHostService_EditExtension_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ExtensionHostServiceServer).EditExtension(ctx, req.(*EditExtensionRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _ExtensionHostService_SubmitForm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(SendExtensionDataRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ExtensionHostServiceServer).SubmitForm(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: ExtensionHostService_SubmitForm_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ExtensionHostServiceServer).SubmitForm(ctx, req.(*SendExtensionDataRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _ExtensionHostService_Close_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ExtensionRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ExtensionHostServiceServer).Close(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: ExtensionHostService_Close_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ExtensionHostServiceServer).Close(ctx, req.(*ExtensionRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _ExtensionHostService_GetUI_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ExtensionRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ExtensionHostServiceServer).GetUI(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: ExtensionHostService_GetUI_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ExtensionHostServiceServer).GetUI(ctx, req.(*ExtensionRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// ExtensionHostService_ServiceDesc is the grpc.ServiceDesc for ExtensionHostService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ExtensionHostService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "hiddifyrpc.ExtensionHostService",
	HandlerType: (*ExtensionHostServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ListExtensions",
			Handler:    _ExtensionHostService_ListExtensions_Handler,
		},
		{
			MethodName: "EditExtension",
			Handler:    _ExtensionHostService_EditExtension_Handler,
		},
		{
			MethodName: "SubmitForm",
			Handler:    _ExtensionHostService_SubmitForm_Handler,
		},
		{
			MethodName: "Close",
			Handler:    _ExtensionHostService_Close_Handler,
		},
		{
			MethodName: "GetUI",
			Handler:    _ExtensionHostService_GetUI_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Connect",
			Handler:       _ExtensionHostService_Connect_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "extension.proto",
}
