package config

import (
	"image/color"
)

type BasicConfig struct {
	Server  ServerConfig  `yaml:"server"`
	Mysql   MysqlConfig   `yaml:"mysql"`
	Redis   RedisConfig   `yaml:"redis"`
	Jwt     JwtConfig     `yaml:"jwt"`
	NanoId  NanoIdConfig  `yaml:"nanoId"`
	Captcha CaptchaConfig `yaml:"captcha"`
}

type NanoIdConfig struct {
	Sequence string `yaml:"sequence"`
	Length   int    `yaml:"length"`
}

type JwtConfig struct {
	Secret string `yaml:"secret"`
	Expire int64  `yaml:"expire"`
}

type MysqlConfig struct {
	DataSources []string `yaml:"dataSources"`
	AutoSync    bool     `yaml:"autoSync"`
}

type ServerConfig struct {
	// 监听 地址:端口
	Addr string `yaml:"addr"`
	// 是否开启多进程
	PreFork bool `yaml:"preFork"`
	// 路由 大小写严格
	CaseSensitive bool `yaml:"caseSensitive"`
	// 严格路由 例: 设置为 true 时, /foo != /foo/
	StrictRouting bool `yaml:"strictRouting"`
	// 设置 Http 请求头中的 Server 名称
	ServerHeader string `yaml:"serverHeader"`
	// 是否添加 /routes 路由 用于获取所有路由信息
	EnableRoutesMsg bool `yaml:"enableRoutesMsg"`
}

type RedisConfig struct {
	Addr string `yaml:"addr"`
	Pass string `yaml:"pass"`
	DB   int    `yaml:"db"`
}

type CaptchaConfig struct {
	Driver string `yaml:"driver"`

	// Height png height in pixel.
	Height int `yaml:"height"`
	// Width Captcha png width in pixel.
	Width int `yaml:"width"`
	//NoiseCount text noise count.
	NoiseCount int `yaml:"noiseCount"`
	//ShowLineOptions := OptionShowHollowLine | OptionShowSlimeLine | OptionShowSineLine .
	ShowLineOptions int `yaml:"showLineOptions"`
	//Length random string length.
	Length int `yaml:"length"`
	//Source is a unicode which is the rand string from.
	Source string `yaml:"source"`
	//BgColor captcha image background color (optional)
	BgColor *color.RGBA `yaml:"bgColor"`
}
