// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc             v5.26.1
// source: Builder.proto

package api

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.32.0 or later.
const _ = grpc.SupportPackageIsVersion7

// BuilderClient is the client API for Builder 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 BuilderClient interface {
	// Create a build request.
	CreateBuild(ctx context.Context, in *CreateBuildRequest, opts ...grpc.CallOption) (*CreateBuildResponse, error)
	// Perform the build.
	// Executes the entire build sequence with attaching input/output
	// to handling data exchange with the server during the build.
	PerformBuild(ctx context.Context, opts ...grpc.CallOption) (Builder_PerformBuildClient, error)
	Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error)
}

type builderClient struct {
	cc grpc.ClientConnInterface
}

func NewBuilderClient(cc grpc.ClientConnInterface) BuilderClient {
	return &builderClient{cc}
}

func (c *builderClient) CreateBuild(ctx context.Context, in *CreateBuildRequest, opts ...grpc.CallOption) (*CreateBuildResponse, error) {
	out := new(CreateBuildResponse)
	err := c.cc.Invoke(ctx, "/com.apple.container.build.v1.Builder/CreateBuild", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *builderClient) PerformBuild(ctx context.Context, opts ...grpc.CallOption) (Builder_PerformBuildClient, error) {
	stream, err := c.cc.NewStream(ctx, &Builder_ServiceDesc.Streams[0], "/com.apple.container.build.v1.Builder/PerformBuild", opts...)
	if err != nil {
		return nil, err
	}
	x := &builderPerformBuildClient{stream}
	return x, nil
}

type Builder_PerformBuildClient interface {
	Send(*ClientStream) error
	Recv() (*ServerStream, error)
	grpc.ClientStream
}

type builderPerformBuildClient struct {
	grpc.ClientStream
}

func (x *builderPerformBuildClient) Send(m *ClientStream) error {
	return x.ClientStream.SendMsg(m)
}

func (x *builderPerformBuildClient) Recv() (*ServerStream, error) {
	m := new(ServerStream)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *builderClient) Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error) {
	out := new(InfoResponse)
	err := c.cc.Invoke(ctx, "/com.apple.container.build.v1.Builder/Info", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// BuilderServer is the server API for Builder service.
// All implementations must embed UnimplementedBuilderServer
// for forward compatibility
type BuilderServer interface {
	// Create a build request.
	CreateBuild(context.Context, *CreateBuildRequest) (*CreateBuildResponse, error)
	// Perform the build.
	// Executes the entire build sequence with attaching input/output
	// to handling data exchange with the server during the build.
	PerformBuild(Builder_PerformBuildServer) error
	Info(context.Context, *InfoRequest) (*InfoResponse, error)
	mustEmbedUnimplementedBuilderServer()
}

// UnimplementedBuilderServer must be embedded to have forward compatible implementations.
type UnimplementedBuilderServer struct {
}

func (UnimplementedBuilderServer) CreateBuild(context.Context, *CreateBuildRequest) (*CreateBuildResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method CreateBuild not implemented")
}
func (UnimplementedBuilderServer) PerformBuild(Builder_PerformBuildServer) error {
	return status.Errorf(codes.Unimplemented, "method PerformBuild not implemented")
}
func (UnimplementedBuilderServer) Info(context.Context, *InfoRequest) (*InfoResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Info not implemented")
}
func (UnimplementedBuilderServer) mustEmbedUnimplementedBuilderServer() {}

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

func RegisterBuilderServer(s grpc.ServiceRegistrar, srv BuilderServer) {
	s.RegisterService(&Builder_ServiceDesc, srv)
}

func _Builder_CreateBuild_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(CreateBuildRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(BuilderServer).CreateBuild(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/com.apple.container.build.v1.Builder/CreateBuild",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(BuilderServer).CreateBuild(ctx, req.(*CreateBuildRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Builder_PerformBuild_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(BuilderServer).PerformBuild(&builderPerformBuildServer{stream})
}

type Builder_PerformBuildServer interface {
	Send(*ServerStream) error
	Recv() (*ClientStream, error)
	grpc.ServerStream
}

type builderPerformBuildServer struct {
	grpc.ServerStream
}

func (x *builderPerformBuildServer) Send(m *ServerStream) error {
	return x.ServerStream.SendMsg(m)
}

func (x *builderPerformBuildServer) Recv() (*ClientStream, error) {
	m := new(ClientStream)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func _Builder_Info_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(InfoRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(BuilderServer).Info(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/com.apple.container.build.v1.Builder/Info",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(BuilderServer).Info(ctx, req.(*InfoRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// Builder_ServiceDesc is the grpc.ServiceDesc for Builder service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Builder_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "com.apple.container.build.v1.Builder",
	HandlerType: (*BuilderServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateBuild",
			Handler:    _Builder_CreateBuild_Handler,
		},
		{
			MethodName: "Info",
			Handler:    _Builder_Info_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "PerformBuild",
			Handler:       _Builder_PerformBuild_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "Builder.proto",
}
