func (entry *CommonServiceEntry) UnmarshalJSON([]byte) error {
	return nil
}
UnmarshalJSON Not supported.
package rkgrpc
import (
	"context"
	"encoding/json"
	"fmt"
	gwruntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
	"github.com/rookie-ninja/rk-common/common"
	"github.com/rookie-ninja/rk-entry/entry"
	api "github.com/rookie-ninja/rk-grpc/boot/api/third_party/gen/v1"
	"github.com/rookie-ninja/rk-grpc/interceptor"
	"github.com/rookie-ninja/rk-grpc/interceptor/context"
	"github.com/rookie-ninja/rk-grpc/interceptor/metrics/prom"
	"github.com/rookie-ninja/rk-query"
	"go.uber.org/zap"
	"google.golang.org/genproto/googleapis/rpc/code"
	"google.golang.org/grpc"
	"google.golang.org/grpc/codes"
	"google.golang.org/protobuf/types/known/structpb"
	"net/http"
	"path"
	"runtime"
)
const (
	CommonServiceEntryType = "GrpcCommonServiceEntry"
	CommonServiceEntryNameDefault = "GrpcCommonServiceDefault"
	CommonServiceEntryDescription = "Internal RK entry which implements commonly used API with grpc framework."
	CommonServiceGwMappingFilePath = "api/v1/gw_mapping.yaml"
)
type BootConfigCommonService struct {
	Enabled bool `yaml:"enabled"`
}
type CommonServiceEntry struct {
	EntryName         string                    `json:"entryName" yaml:"entryName"`
	EntryType         string                    `json:"entryType" yaml:"entryType"`
	EntryDescription  string                    `json:"entryDescription" yaml:"entryDescription"`
	EventLoggerEntry  *rkentry.EventLoggerEntry `json:"eventLoggerEntry" yaml:"eventLoggerEntry"`
	ZapLoggerEntry    *rkentry.ZapLoggerEntry   `json:"zapLoggerEntry" yaml:"zapLoggerEntry"`
	GrpcRegF          GrpcRegFunc               `json:"regFuncGrpc" yaml:"regFuncGrpc"`
	GwRegF            GwRegFunc                 `json:"regFuncGw" yaml:"regFuncGw"`
	GwMappingFilePath string                    `json:"gwMappingFilePath" yaml:"gwMappingFilePath"`
	GwMapping         map[string]string         `json:"gwMapping" yaml:"gwMapping"`
}
type CommonServiceEntryOption func(*CommonServiceEntry)
func WithNameCommonService(name string) CommonServiceEntryOption {
	return func(entry *CommonServiceEntry) {
		entry.EntryName = name
	}
}
func WithEventLoggerEntryCommonService(eventLoggerEntry *rkentry.EventLoggerEntry) CommonServiceEntryOption {
	return func(entry *CommonServiceEntry) {
		entry.EventLoggerEntry = eventLoggerEntry
	}
}
func WithZapLoggerEntryCommonService(zapLoggerEntry *rkentry.ZapLoggerEntry) CommonServiceEntryOption {
	return func(entry *CommonServiceEntry) {
		entry.ZapLoggerEntry = zapLoggerEntry
	}
}
func NewCommonServiceEntry(opts ...CommonServiceEntryOption) *CommonServiceEntry {
	entry := &CommonServiceEntry{
		EntryName:         CommonServiceEntryNameDefault,
		EntryType:         CommonServiceEntryType,
		EntryDescription:  CommonServiceEntryDescription,
		ZapLoggerEntry:    rkentry.GlobalAppCtx.GetZapLoggerEntryDefault(),
		EventLoggerEntry:  rkentry.GlobalAppCtx.GetEventLoggerEntryDefault(),
		GrpcRegF:          registerRkCommonService,
		GwRegF:            api.RegisterRkCommonServiceHandlerFromEndpoint,
		GwMappingFilePath: CommonServiceGwMappingFilePath,
		GwMapping:         make(map[string]string),
	}
	for i := range opts {
		opts[i](entry)
	}
	return entry
}
func (entry *CommonServiceEntry) Bootstrap(ctx context.Context) {
	event := entry.EventLoggerEntry.GetEventHelper().Start(
		"bootstrap",
		rkquery.WithEntryName(entry.EntryName),
		rkquery.WithEntryType(entry.EntryType))
	logger := entry.ZapLoggerEntry.GetLogger()
	if raw := ctx.Value(bootstrapEventIdKey); raw != nil {
		event.SetEventId(raw.(string))
		logger = logger.With(zap.String("eventId", event.GetEventId()))
	}
	entry.logBasicInfo(event)
	defer entry.EventLoggerEntry.GetEventHelper().Finish(event)
	logger.Info("Bootstrapping CommonServiceEntry.", event.ListPayloads()...)
}
func (entry *CommonServiceEntry) Interrupt(ctx context.Context) {
	event := entry.EventLoggerEntry.GetEventHelper().Start(
		"interrupt",
		rkquery.WithEntryName(entry.EntryName),
		rkquery.WithEntryType(entry.EntryType))
	logger := entry.ZapLoggerEntry.GetLogger()
	if raw := ctx.Value(bootstrapEventIdKey); raw != nil {
		event.SetEventId(raw.(string))
		logger = logger.With(zap.String("eventId", event.GetEventId()))
	}
	entry.logBasicInfo(event)
	defer entry.EventLoggerEntry.GetEventHelper().Finish(event)
	logger.Info("Interrupting CommonServiceEntry.", event.ListPayloads()...)
}
func (entry *CommonServiceEntry) GetName() string {
	return entry.EntryName
}
func (entry *CommonServiceEntry) GetType() string {
	return entry.EntryType
}
func (entry *CommonServiceEntry) String() string {
	bytes, _ := json.Marshal(entry)
	return string(bytes)
}
func (entry *CommonServiceEntry) MarshalJSON() ([]byte, error) {
	m := map[string]interface{}{
		"entryName":        entry.EntryName,
		"entryType":        entry.EntryType,
		"entryDescription": entry.EntryDescription,
		"zapLoggerEntry":   entry.ZapLoggerEntry.GetName(),
		"eventLoggerEntry": entry.EventLoggerEntry.GetName(),
	}
	return json.Marshal(&m)
}