package domain

type ServerConfigBuild struct {
	Destroy int
}

type ServerConfigMisc struct {
	KillRanking     int
	Tutorial        int
	TradeCancelTime int
}

type ServerConfigCommands struct {
	MillisArrival     int
	CommandCancelTime int
}

type ServerConfigNewbie struct {
	Days                 int
	RatioDays            int
	Ratio                int
	RemoveNewbieVillages int
}

type ServerConfigGame struct {
	BuildtimeFormula   int
	Knight             int
	KnightNewItems     int
	Archer             int
	Tech               int
	FarmLimit          int
	Church             int
	Watchtower         int
	Stronghold         int
	FakeLimit          float64
	BarbarianRise      float64
	BarbarianShrink    int
	BarbarianMaxPoints int
	Scavenging         int
	Hauls              int
	HaulsBase          int
	HaulsMax           int
	BaseProduction     int
	Event              int
	SuppressEvents     int
}

type ServerConfigBuildings struct {
	CustomMain       int
	CustomFarm       int
	CustomStorage    int
	CustomPlace      int
	CustomBarracks   int
	CustomChurch     int
	CustomSmith      int
	CustomWood       int
	CustomStone      int
	CustomIron       int
	CustomMarket     int
	CustomStable     int
	CustomWall       int
	CustomGarage     int
	CustomHide       int
	CustomSnob       int
	CustomStatue     int
	CustomWatchtower int
}

type ServerConfigSnob struct {
	Gold          int
	CheapRebuild  int
	Rise          int
	MaxDist       int
	Factor        float64
	CoinWood      int
	CoinStone     int
	CoinIron      int
	NoBarbConquer int
}

type ServerConfigAlly struct {
	NoHarm                int
	NoOtherSupport        int
	NoOtherSupportType    int
	AllytimeSupport       int
	NoLeave               int
	NoJoin                int
	Limit                 int
	FixedAllies           int
	PointsMemberCount     int
	WarsMemberRequirement int
	WarsPointsRequirement int
	WarsAutoacceptDays    int
	Levels                int
	XpRequirements        string
}

type ServerConfigCoord struct {
	MapSize         int
	Func            int
	EmptyVillages   int
	BonusVillages   int
	BonusNew        int
	Inner           int
	SelectStart     int
	VillageMoveWait int
	NobleRestart    int
	StartVillages   int
}

type ServerConfigSitter struct {
	Allow int
}

type ServerConfigSleep struct {
	Active   int
	Delay    int
	Min      int
	Max      int
	MinAwake int
	MaxAwake int
	WarnTime int
}

type ServerConfigNight struct {
	Active    int
	StartHour int
	EndHour   int
	DefFactor float64
	Duration  int
}

type ServerConfigWin struct {
	Check int
}

type ServerConfig struct {
	speed     float64
	unitSpeed float64
	moral     int
	build     ServerConfigBuild
	misc      ServerConfigMisc
	commands  ServerConfigCommands
	newbie    ServerConfigNewbie
	game      ServerConfigGame
	buildings ServerConfigBuildings
	snob      ServerConfigSnob
	ally      ServerConfigAlly
	coord     ServerConfigCoord
	sitter    ServerConfigSitter
	sleep     ServerConfigSleep
	night     ServerConfigNight
	win       ServerConfigWin
}

type NullServerConfig = NullValue[ServerConfig]

func NewServerConfig(
	speed float64,
	unitSpeed float64,
	moral int,
	build ServerConfigBuild,
	misc ServerConfigMisc,
	commands ServerConfigCommands,
	newbie ServerConfigNewbie,
	game ServerConfigGame,
	buildings ServerConfigBuildings,
	snob ServerConfigSnob,
	ally ServerConfigAlly,
	coord ServerConfigCoord,
	sitter ServerConfigSitter,
	sleep ServerConfigSleep,
	night ServerConfigNight,
	win ServerConfigWin,
) (ServerConfig, error) {
	return ServerConfig{
		speed:     speed,
		unitSpeed: unitSpeed,
		moral:     moral,
		build:     build,
		misc:      misc,
		commands:  commands,
		newbie:    newbie,
		game:      game,
		buildings: buildings,
		snob:      snob,
		ally:      ally,
		coord:     coord,
		sitter:    sitter,
		sleep:     sleep,
		night:     night,
		win:       win,
	}, nil
}

func (s ServerConfig) Speed() float64 {
	return s.speed
}

func (s ServerConfig) UnitSpeed() float64 {
	return s.unitSpeed
}

func (s ServerConfig) Moral() int {
	return s.moral
}

func (s ServerConfig) Build() ServerConfigBuild {
	return s.build
}

func (s ServerConfig) Misc() ServerConfigMisc {
	return s.misc
}

func (s ServerConfig) Commands() ServerConfigCommands {
	return s.commands
}

func (s ServerConfig) Newbie() ServerConfigNewbie {
	return s.newbie
}

func (s ServerConfig) Game() ServerConfigGame {
	return s.game
}

func (s ServerConfig) Buildings() ServerConfigBuildings {
	return s.buildings
}

func (s ServerConfig) Snob() ServerConfigSnob {
	return s.snob
}

func (s ServerConfig) Ally() ServerConfigAlly {
	return s.ally
}

func (s ServerConfig) Coord() ServerConfigCoord {
	return s.coord
}

func (s ServerConfig) Sitter() ServerConfigSitter {
	return s.sitter
}

func (s ServerConfig) Sleep() ServerConfigSleep {
	return s.sleep
}

func (s ServerConfig) Night() ServerConfigNight {
	return s.night
}

func (s ServerConfig) Win() ServerConfigWin {
	return s.win
}
