// Code generated by protoc-gen-slc. DO NOT EDIT.
package server

import (
	pb "bsm/full/module/ec/mall/pb"
	"context"

	gwRuntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
	"google.golang.org/grpc"
	"google.golang.org/grpc/reflection"
)

type Server struct {
	Grpc      *grpc.Server
	Ctx       context.Context
	Mux       *gwRuntime.ServeMux
	grpcConns map[string]*grpc.ClientConn // 连接池
}

func New(addr string) *Server {
	srv := &Server{
		Ctx:       context.Background(),
		Grpc:      grpc.NewServer(),
		grpcConns: make(map[string]*grpc.ClientConn),
	}

	// register service to grpc.Server
	pb.RegisterAdsServer(srv.Grpc, NewAdsServer())
	pb.RegisterCategoryServer(srv.Grpc, NewCategoryServer())
	pb.RegisterFreightServer(srv.Grpc, NewFreightServer())
	pb.RegisterNoticeServer(srv.Grpc, NewNoticeServer())
	pb.RegisterProductServer(srv.Grpc, NewProductServer())
	pb.RegisterStaffServer(srv.Grpc, NewStaffServer())
	pb.RegisterStoreServer(srv.Grpc, NewStoreServer())

	reflection.Register(srv.Grpc)

	return srv
}
