// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc             v7.35.0
// source: module/base/cms/proto/category.proto

package cms

import (
	protobuf "bsm/full/protobuf"
	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 (
	Category_Fetch_FullMethodName  = "/cms.Category/Fetch"
	Category_Create_FullMethodName = "/cms.Category/Create"
	Category_Modify_FullMethodName = "/cms.Category/Modify"
	Category_Delete_FullMethodName = "/cms.Category/Delete"
)

// CategoryClient is the client API for Category 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.
//
// CMS - 分类
type CategoryClient interface {
	// 分类列表
	Fetch(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*CategoryListReply, error)
	// 添加分类
	Create(ctx context.Context, in *protobuf.CmsCategoryItem, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
	// 修改分类
	Modify(ctx context.Context, in *ModifyCategoryRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
	// 删除分类
	Delete(ctx context.Context, in *DeleteCategoryRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
}

type categoryClient struct {
	cc grpc.ClientConnInterface
}

func NewCategoryClient(cc grpc.ClientConnInterface) CategoryClient {
	return &categoryClient{cc}
}

func (c *categoryClient) Fetch(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*CategoryListReply, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(CategoryListReply)
	err := c.cc.Invoke(ctx, Category_Fetch_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *categoryClient) Create(ctx context.Context, in *protobuf.CmsCategoryItem, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(protobuf.StatusReply)
	err := c.cc.Invoke(ctx, Category_Create_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *categoryClient) Modify(ctx context.Context, in *ModifyCategoryRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(protobuf.StatusReply)
	err := c.cc.Invoke(ctx, Category_Modify_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *categoryClient) Delete(ctx context.Context, in *DeleteCategoryRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(protobuf.StatusReply)
	err := c.cc.Invoke(ctx, Category_Delete_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// CategoryServer is the server API for Category service.
// All implementations should embed UnimplementedCategoryServer
// for forward compatibility.
//
// CMS - 分类
type CategoryServer interface {
	// 分类列表
	Fetch(context.Context, *protobuf.IdentRequest) (*CategoryListReply, error)
	// 添加分类
	Create(context.Context, *protobuf.CmsCategoryItem) (*protobuf.StatusReply, error)
	// 修改分类
	Modify(context.Context, *ModifyCategoryRequest) (*protobuf.StatusReply, error)
	// 删除分类
	Delete(context.Context, *DeleteCategoryRequest) (*protobuf.StatusReply, error)
}

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

func (UnimplementedCategoryServer) Fetch(context.Context, *protobuf.IdentRequest) (*CategoryListReply, error) {
	return nil, status.Error(codes.Unimplemented, "method Fetch not implemented")
}
func (UnimplementedCategoryServer) Create(context.Context, *protobuf.CmsCategoryItem) (*protobuf.StatusReply, error) {
	return nil, status.Error(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedCategoryServer) Modify(context.Context, *ModifyCategoryRequest) (*protobuf.StatusReply, error) {
	return nil, status.Error(codes.Unimplemented, "method Modify not implemented")
}
func (UnimplementedCategoryServer) Delete(context.Context, *DeleteCategoryRequest) (*protobuf.StatusReply, error) {
	return nil, status.Error(codes.Unimplemented, "method Delete not implemented")
}
func (UnimplementedCategoryServer) testEmbeddedByValue() {}

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

func RegisterCategoryServer(s grpc.ServiceRegistrar, srv CategoryServer) {
	// If the following call panics, it indicates UnimplementedCategoryServer 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(&Category_ServiceDesc, srv)
}

func _Category_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(protobuf.IdentRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CategoryServer).Fetch(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Category_Fetch_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CategoryServer).Fetch(ctx, req.(*protobuf.IdentRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Category_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(protobuf.CmsCategoryItem)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CategoryServer).Create(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Category_Create_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CategoryServer).Create(ctx, req.(*protobuf.CmsCategoryItem))
	}
	return interceptor(ctx, in, info, handler)
}

func _Category_Modify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ModifyCategoryRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CategoryServer).Modify(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Category_Modify_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CategoryServer).Modify(ctx, req.(*ModifyCategoryRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Category_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(DeleteCategoryRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CategoryServer).Delete(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Category_Delete_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CategoryServer).Delete(ctx, req.(*DeleteCategoryRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// Category_ServiceDesc is the grpc.ServiceDesc for Category service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Category_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "cms.Category",
	HandlerType: (*CategoryServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Fetch",
			Handler:    _Category_Fetch_Handler,
		},
		{
			MethodName: "Create",
			Handler:    _Category_Create_Handler,
		},
		{
			MethodName: "Modify",
			Handler:    _Category_Modify_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _Category_Delete_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "module/base/cms/proto/category.proto",
}
