package config

type Config struct {
	Database DatabaseConfig `yaml:"database" mapstructure:"database"`
	API      APIConfig      `yaml:"api" mapstructure:"api"`
	CLI      CLIConfig      `yaml:"cli" mapstructure:"cli"`
	Server   ServerConfig   `yaml:"server" mapstructure:"server"`
	Auth     AuthConfig     `yaml:"auth" mapstructure:"auth"`
}

type DatabaseConfig struct {
	Path string `yaml:"path" mapstructure:"path"`
}

type APIConfig struct {
	URL string `yaml:"url" mapstructure:"url"`
	Key string `yaml:"key" mapstructure:"key"`
}

type CLIConfig struct {
	SiteID string `yaml:"site_id" mapstructure:"site_id"`
}

type ServerConfig struct {
	Port  int          `yaml:"port" mapstructure:"port"`
	Host  string       `yaml:"host" mapstructure:"host"`
	Sites []SiteConfig `yaml:"sites" mapstructure:"sites"`
}

type AuthConfig struct {
	DevMode      bool                   `yaml:"dev_mode" mapstructure:"dev_mode"`
	Provider     string                 `yaml:"provider" mapstructure:"provider"`
	JWTSecret    string                 `yaml:"jwt_secret" mapstructure:"jwt_secret"`
	OAuthConfigs map[string]OAuthConfig `yaml:"oauth_configs" mapstructure:"oauth_configs"`
	OIDC         *OIDCConfig            `yaml:"oidc" mapstructure:"oidc"`
}

type OAuthConfig struct {
	ClientID     string   `yaml:"client_id" mapstructure:"client_id"`
	ClientSecret string   `yaml:"client_secret" mapstructure:"client_secret"`
	RedirectURL  string   `yaml:"redirect_url" mapstructure:"redirect_url"`
	Scopes       []string `yaml:"scopes" mapstructure:"scopes"`
}

type OIDCConfig struct {
	Endpoint     string   `yaml:"endpoint" mapstructure:"endpoint"`
	ClientID     string   `yaml:"client_id" mapstructure:"client_id"`
	ClientSecret string   `yaml:"client_secret" mapstructure:"client_secret"`
	RedirectURL  string   `yaml:"redirect_url" mapstructure:"redirect_url"`
	Scopes       []string `yaml:"scopes" mapstructure:"scopes"`
}

type SiteConfig struct {
	SiteID      string           `yaml:"site_id" mapstructure:"site_id"`
	Path        string           `yaml:"path" mapstructure:"path"`
	SourcePath  string           `yaml:"source_path" mapstructure:"source_path"`
	Domain      string           `yaml:"domain" mapstructure:"domain"`
	AutoEnhance bool             `yaml:"auto_enhance" mapstructure:"auto_enhance"`
	Discovery   *DiscoveryConfig `yaml:"discovery" mapstructure:"discovery"`
}

type DiscoveryConfig struct {
	Enabled    bool `yaml:"enabled" mapstructure:"enabled"`
	Aggressive bool `yaml:"aggressive" mapstructure:"aggressive"`
	Containers bool `yaml:"containers" mapstructure:"containers"`
	Individual bool `yaml:"individual" mapstructure:"individual"`
}
