// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             (unknown)
// source: powerx/agent/v1/stream.proto

package agentv1

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 (
	AgentStreamService_Stream_FullMethodName   = "/powerx.agent.v1.AgentStreamService/Stream"
	AgentStreamService_Simulate_FullMethodName = "/powerx.agent.v1.AgentStreamService/Simulate"
)

// AgentStreamServiceClient is the client API for AgentStreamService 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.
//
// =============== Agent 流式对话（统一 SSE/WS 事件语义） ===============
type AgentStreamServiceClient interface {
	// 服务端单向流；等价 HTTP 的 /stream/sse 与 WS 的事件序列
	Stream(ctx context.Context, in *StreamRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StreamResponse], error)
	// 模拟流（等价 SimulateSSE，用于探针与前端调试）
	Simulate(ctx context.Context, in *SimulateRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SimulateResponse], error)
}

type agentStreamServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewAgentStreamServiceClient(cc grpc.ClientConnInterface) AgentStreamServiceClient {
	return &agentStreamServiceClient{cc}
}

func (c *agentStreamServiceClient) Stream(ctx context.Context, in *StreamRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StreamResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &AgentStreamService_ServiceDesc.Streams[0], AgentStreamService_Stream_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[StreamRequest, StreamResponse]{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 AgentStreamService_StreamClient = grpc.ServerStreamingClient[StreamResponse]

func (c *agentStreamServiceClient) Simulate(ctx context.Context, in *SimulateRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SimulateResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &AgentStreamService_ServiceDesc.Streams[1], AgentStreamService_Simulate_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[SimulateRequest, SimulateResponse]{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 AgentStreamService_SimulateClient = grpc.ServerStreamingClient[SimulateResponse]

// AgentStreamServiceServer is the server API for AgentStreamService service.
// All implementations must embed UnimplementedAgentStreamServiceServer
// for forward compatibility.
//
// =============== Agent 流式对话（统一 SSE/WS 事件语义） ===============
type AgentStreamServiceServer interface {
	// 服务端单向流；等价 HTTP 的 /stream/sse 与 WS 的事件序列
	Stream(*StreamRequest, grpc.ServerStreamingServer[StreamResponse]) error
	// 模拟流（等价 SimulateSSE，用于探针与前端调试）
	Simulate(*SimulateRequest, grpc.ServerStreamingServer[SimulateResponse]) error
	mustEmbedUnimplementedAgentStreamServiceServer()
}

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

func (UnimplementedAgentStreamServiceServer) Stream(*StreamRequest, grpc.ServerStreamingServer[StreamResponse]) error {
	return status.Errorf(codes.Unimplemented, "method Stream not implemented")
}
func (UnimplementedAgentStreamServiceServer) Simulate(*SimulateRequest, grpc.ServerStreamingServer[SimulateResponse]) error {
	return status.Errorf(codes.Unimplemented, "method Simulate not implemented")
}
func (UnimplementedAgentStreamServiceServer) mustEmbedUnimplementedAgentStreamServiceServer() {}
func (UnimplementedAgentStreamServiceServer) testEmbeddedByValue()                            {}

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

func RegisterAgentStreamServiceServer(s grpc.ServiceRegistrar, srv AgentStreamServiceServer) {
	// If the following call pancis, it indicates UnimplementedAgentStreamServiceServer 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(&AgentStreamService_ServiceDesc, srv)
}

func _AgentStreamService_Stream_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(StreamRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(AgentStreamServiceServer).Stream(m, &grpc.GenericServerStream[StreamRequest, StreamResponse]{ServerStream: stream})
}

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

func _AgentStreamService_Simulate_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(SimulateRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(AgentStreamServiceServer).Simulate(m, &grpc.GenericServerStream[SimulateRequest, SimulateResponse]{ServerStream: stream})
}

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

// AgentStreamService_ServiceDesc is the grpc.ServiceDesc for AgentStreamService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var AgentStreamService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "powerx.agent.v1.AgentStreamService",
	HandlerType: (*AgentStreamServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Stream",
			Handler:       _AgentStreamService_Stream_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "Simulate",
			Handler:       _AgentStreamService_Simulate_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "powerx/agent/v1/stream.proto",
}
