// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             (unknown)
// source: examples/internal/proto/examplepb/use_allof_for_refs.proto

package examplepb

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 (
	UseAllOfForRefsService_GetExample_FullMethodName = "/grpc.gateway.examples.internal.proto.examplepb.UseAllOfForRefsService/GetExample"
)

// UseAllOfForRefsServiceClient is the client API for UseAllOfForRefsService 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.
//
// UseAllOfForRefsService demonstrates the use_allof_for_refs option.
//
// When that option is enabled, a field that is a message reference normally
// renders as a bare "$ref". Per the JSON Reference syntax any sibling members
// of a "$ref" are ignored, so the field is instead wrapped in an "allOf" to
// preserve its title, description and OpenAPI extensions next to the ref.
//
// This example also enables proto3_optional_nullable. Proto3 optional message
// fields must keep x-nullable alongside the allOf wrapper.
type UseAllOfForRefsServiceClient interface {
	GetExample(ctx context.Context, in *GetExampleRequest, opts ...grpc.CallOption) (*GetExampleResponse, error)
}

type useAllOfForRefsServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewUseAllOfForRefsServiceClient(cc grpc.ClientConnInterface) UseAllOfForRefsServiceClient {
	return &useAllOfForRefsServiceClient{cc}
}

func (c *useAllOfForRefsServiceClient) GetExample(ctx context.Context, in *GetExampleRequest, opts ...grpc.CallOption) (*GetExampleResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetExampleResponse)
	err := c.cc.Invoke(ctx, UseAllOfForRefsService_GetExample_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// UseAllOfForRefsServiceServer is the server API for UseAllOfForRefsService service.
// All implementations should embed UnimplementedUseAllOfForRefsServiceServer
// for forward compatibility.
//
// UseAllOfForRefsService demonstrates the use_allof_for_refs option.
//
// When that option is enabled, a field that is a message reference normally
// renders as a bare "$ref". Per the JSON Reference syntax any sibling members
// of a "$ref" are ignored, so the field is instead wrapped in an "allOf" to
// preserve its title, description and OpenAPI extensions next to the ref.
//
// This example also enables proto3_optional_nullable. Proto3 optional message
// fields must keep x-nullable alongside the allOf wrapper.
type UseAllOfForRefsServiceServer interface {
	GetExample(context.Context, *GetExampleRequest) (*GetExampleResponse, error)
}

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

func (UnimplementedUseAllOfForRefsServiceServer) GetExample(context.Context, *GetExampleRequest) (*GetExampleResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetExample not implemented")
}
func (UnimplementedUseAllOfForRefsServiceServer) testEmbeddedByValue() {}

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

func RegisterUseAllOfForRefsServiceServer(s grpc.ServiceRegistrar, srv UseAllOfForRefsServiceServer) {
	// If the following call pancis, it indicates UnimplementedUseAllOfForRefsServiceServer 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(&UseAllOfForRefsService_ServiceDesc, srv)
}

func _UseAllOfForRefsService_GetExample_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetExampleRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(UseAllOfForRefsServiceServer).GetExample(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: UseAllOfForRefsService_GetExample_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(UseAllOfForRefsServiceServer).GetExample(ctx, req.(*GetExampleRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// UseAllOfForRefsService_ServiceDesc is the grpc.ServiceDesc for UseAllOfForRefsService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var UseAllOfForRefsService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "grpc.gateway.examples.internal.proto.examplepb.UseAllOfForRefsService",
	HandlerType: (*UseAllOfForRefsServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetExample",
			Handler:    _UseAllOfForRefsService_GetExample_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "examples/internal/proto/examplepb/use_allof_for_refs.proto",
}
