// 导入所有配置

package data

import (
	mhayaDataConfig "github.com/mhaya/components/data-config"
	mhayaMapStructure "github.com/mhaya/extend/mapstructure"
	"github.com/mhaya/game/game_cluster/internal/types"
)

var (
	ChannelConfig      = &channelConfig{}
	PlatformConfig     = &platformConfig{}
	RuleConfig         = &ruleConfig{}
	AchieveTaskConfig  = &achieveTaskConfig{}
	DailyTaskConfig    = &dailyTaskConfig{}
	DiscreteRuleConfig = &discreteRuleConfig{}
	DrawConfig         = &drawConfig{}
	ItemConfig         = &itemConfig{}
	LevelConfig        = &levelConfig{}
	RankConfig         = &rankConfig{}
	RankRewardConfig   = &rankRewardConfig{}
	SdkConfig          = &sdkConfig{}
	WeeklySignInConfig = &weeklySignInConfig{}
	CodeConfig         = &codeConfig{}
	InviteConfig       = &inviteConfig{}
	RocketLvConfig     = &rocketLvConfig{}
	ContryConfig       = &contryConfig{}
	PlayerConfig       = &playerConfig{}
	KolConfig          = &kolConfig{}
	ServerConfig       = &serverConfig{}
)

func New() *mhayaDataConfig.Component {
	dataConfig := mhayaDataConfig.New()
	dataConfig.Register(
		ChannelConfig,
		PlatformConfig,
		RuleConfig,
		AchieveTaskConfig,
		DailyTaskConfig,
		DiscreteRuleConfig,
		DrawConfig,
		ItemConfig,
		LevelConfig,
		RankConfig,
		RankRewardConfig,
		SdkConfig,
		WeeklySignInConfig,
		CodeConfig,
		InviteConfig,
		RocketLvConfig,
		ContryConfig,
		PlayerConfig,
		KolConfig,
		ServerConfig,
	)
	return dataConfig
}

func DecodeData(input interface{}, output interface{}) error {
	return mhayaMapStructure.HookDecode(
		input,
		output,
		"json",
		types.GetDecodeHooks(),
	)
}
