package model

type SettingForm struct {
	DNSServers                  string `json:"dns_servers,omitempty" validate:"optional"`
	IgnoredIPNotification       string `json:"ignored_ip_notification,omitempty" validate:"optional"`
	IPChangeNotificationGroupID uint64 `json:"ip_change_notification_group_id,omitempty"` // IP变更提醒的通知组
	Cover                       uint8  `json:"cover,omitempty"`
	SiteName                    string `json:"site_name,omitempty" minLength:"1"`
	Language                    string `json:"language,omitempty" minLength:"2"`
	InstallHost                 string `json:"install_host,omitempty" validate:"optional"`
	CustomCode                  string `json:"custom_code,omitempty" validate:"optional"`
	CustomCodeDashboard         string `json:"custom_code_dashboard,omitempty" validate:"optional"`
	WebRealIPHeader             string `json:"web_real_ip_header,omitempty" validate:"optional"`   // 前端真实IP
	AgentRealIPHeader           string `json:"agent_real_ip_header,omitempty" validate:"optional"` // Agent真实IP
	UserTemplate                string `json:"user_template,omitempty" validate:"optional"`
	CustomLogo                  string `json:"custom_logo,omitempty" validate:"optional"`
	CustomDescription           string `json:"custom_description,omitempty" validate:"optional"`
	CustomLinks                 string `json:"custom_links,omitempty" validate:"optional"`
	BackgroundImageDay          string `json:"background_image_day,omitempty" validate:"optional"`
	BackgroundImageNight        string `json:"background_image_night,omitempty" validate:"optional"`

	AgentTLS                    bool   `json:"tls,omitempty" validate:"optional"`
	EnableIPChangeNotification  bool   `json:"enable_ip_change_notification,omitempty" validate:"optional"`
	EnablePlainIPInNotification bool   `json:"enable_plain_ip_in_notification,omitempty" validate:"optional"`
	ExpiryNotificationGroupID   uint64 `json:"expiry_notification_group_id,omitempty"`
	TelegramBotToken            string `json:"telegram_bot_token,omitempty" validate:"optional"`
	TelegramAdminChatID         string `json:"telegram_admin_chat_id,omitempty" validate:"optional"`

	SMTPServer                  string `json:"smtp_server,omitempty" validate:"optional"`
	SMTPUser                    string `json:"smtp_user,omitempty" validate:"optional"`
	SMTPPassword                string `json:"smtp_password,omitempty" validate:"optional"`
	AdminEmail                  string `json:"admin_email,omitempty" validate:"optional"`
	DomainExpiryNotificationDays string `json:"domain_expiry_notification_days,omitempty" validate:"optional"`
	ServerExpiryNotificationDays string `json:"server_expiry_notification_days,omitempty" validate:"optional"`
}

type Setting struct {
	ConfigForGuests
	ConfigDashboard

	IgnoredIPNotificationServerIDs map[uint64]bool `json:"ignored_ip_notification_server_ids,omitempty"`
	Oauth2Providers                []string        `json:"oauth2_providers,omitempty"`
}

type FrontendTemplate struct {
	Path       string `json:"path,omitempty"`
	Name       string `json:"name,omitempty"`
	Repository string `json:"repository,omitempty"`
	Author     string `json:"author,omitempty"`
	Version    string `json:"version,omitempty"`
	IsAdmin    bool   `json:"is_admin,omitempty"`
	IsOfficial bool   `json:"is_official,omitempty"`
}

type SettingResponse struct {
	Config Setting `json:"config"`

	Version           string             `json:"version,omitempty"`
	FrontendTemplates []FrontendTemplate `json:"frontend_templates,omitempty"`
	TSDBEnabled       bool               `json:"tsdb_enabled"`
}
