package config

type AppConfig struct {
	Name string `yaml:"name"`
}

type LogConfig struct {
	Debug      bool   `yaml:"debug"`
	MaxSize    int32  `yaml:"maxSize"`
	MaxBackups int32  `yaml:"maxBackups"`
	MaxAge     int32  `yaml:"maxAge"`
	Level      string `yaml:"level"`
}

type MonitorConfig struct {
	Prometheus *struct {
		Address string `yaml:"address"`
		Port    int32  `yaml:"port"`
	} `yaml:"prometheus"`
}

type DBConfig struct {
	Etcd  *EtcdConfig             `yaml:"etcd"`
	MySQL map[string]*MySQLConfig `yaml:"mysql"`
}

type EtcdConfig struct {
	Endpoints []string `yaml:"endpoints"`
}

type MySQLConfig struct {
	Dsn                string `yaml:"dsn"`
	MaxOpenConn        int32  `yaml:"max_open_conn"`
	MaxIdleConn        int32  `yaml:"max_idle_conn"`
	ConnMaxLifetimeSec int32  `yaml:"conn_max_lifetime_sec"`
	ConnMaxIdleTimeSec int32  `yaml:"conn_max_idle_time_sec"`
	LogLevel           string `yaml:"log_level"`
}

type ServeConfig struct {
	Grpc *struct {
		Address string `yaml:"address"`
		Port    int32  `yaml:"port"`
		TTL     int64  `yaml:"ttl"`
	} `yaml:"grpc"`
	Socket *struct {
		Web *AddressConfig `yaml:"web"`
		Raw *AddressConfig `yaml:"raw"`
	} `yaml:"socket"`
	Http *AddressConfig `yaml:"http"`
}

type AddressConfig struct {
	Address string `yaml:"address"`
	Port    int32  `yaml:"port"`
}
