// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc             v4.25.1
// source: service_scene.proto

package grpc_pb

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

// SceneClient is the client API for Scene 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 SceneClient interface {
	Enter(ctx context.Context, in *EnterReq, opts ...grpc.CallOption) (*EnterResp, error)
	Leave(ctx context.Context, in *LeaveReq, opts ...grpc.CallOption) (*LeaveResp, error)
	Action(ctx context.Context, opts ...grpc.CallOption) (Scene_ActionClient, error)
}

type sceneClient struct {
	cc grpc.ClientConnInterface
}

func NewSceneClient(cc grpc.ClientConnInterface) SceneClient {
	return &sceneClient{cc}
}

func (c *sceneClient) Enter(ctx context.Context, in *EnterReq, opts ...grpc.CallOption) (*EnterResp, error) {
	out := new(EnterResp)
	err := c.cc.Invoke(ctx, "/Scene/Enter", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *sceneClient) Leave(ctx context.Context, in *LeaveReq, opts ...grpc.CallOption) (*LeaveResp, error) {
	out := new(LeaveResp)
	err := c.cc.Invoke(ctx, "/Scene/Leave", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *sceneClient) Action(ctx context.Context, opts ...grpc.CallOption) (Scene_ActionClient, error) {
	stream, err := c.cc.NewStream(ctx, &Scene_ServiceDesc.Streams[0], "/Scene/Action", opts...)
	if err != nil {
		return nil, err
	}
	x := &sceneActionClient{stream}
	return x, nil
}

type Scene_ActionClient interface {
	Send(*ActionReq) error
	CloseAndRecv() (*ActionResp, error)
	grpc.ClientStream
}

type sceneActionClient struct {
	grpc.ClientStream
}

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

func (x *sceneActionClient) CloseAndRecv() (*ActionResp, error) {
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	m := new(ActionResp)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// SceneServer is the server API for Scene service.
// All implementations must embed UnimplementedSceneServer
// for forward compatibility
type SceneServer interface {
	Enter(context.Context, *EnterReq) (*EnterResp, error)
	Leave(context.Context, *LeaveReq) (*LeaveResp, error)
	Action(Scene_ActionServer) error
	mustEmbedUnimplementedSceneServer()
}

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

func (UnimplementedSceneServer) Enter(context.Context, *EnterReq) (*EnterResp, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Enter not implemented")
}
func (UnimplementedSceneServer) Leave(context.Context, *LeaveReq) (*LeaveResp, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Leave not implemented")
}
func (UnimplementedSceneServer) Action(Scene_ActionServer) error {
	return status.Errorf(codes.Unimplemented, "method Action not implemented")
}
func (UnimplementedSceneServer) mustEmbedUnimplementedSceneServer() {}

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

func RegisterSceneServer(s grpc.ServiceRegistrar, srv SceneServer) {
	s.RegisterService(&Scene_ServiceDesc, srv)
}

func _Scene_Enter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(EnterReq)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SceneServer).Enter(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/Scene/Enter",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SceneServer).Enter(ctx, req.(*EnterReq))
	}
	return interceptor(ctx, in, info, handler)
}

func _Scene_Leave_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(LeaveReq)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SceneServer).Leave(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/Scene/Leave",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SceneServer).Leave(ctx, req.(*LeaveReq))
	}
	return interceptor(ctx, in, info, handler)
}

func _Scene_Action_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(SceneServer).Action(&sceneActionServer{stream})
}

type Scene_ActionServer interface {
	SendAndClose(*ActionResp) error
	Recv() (*ActionReq, error)
	grpc.ServerStream
}

type sceneActionServer struct {
	grpc.ServerStream
}

func (x *sceneActionServer) SendAndClose(m *ActionResp) error {
	return x.ServerStream.SendMsg(m)
}

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

// Scene_ServiceDesc is the grpc.ServiceDesc for Scene service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Scene_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "Scene",
	HandlerType: (*SceneServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Enter",
			Handler:    _Scene_Enter_Handler,
		},
		{
			MethodName: "Leave",
			Handler:    _Scene_Leave_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Action",
			Handler:       _Scene_Action_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "service_scene.proto",
}
