package model

import (
	"embed"

	"github.com/jmoiron/sqlx"

	"arimelody-web/log"
)

type (
    DBConfig struct {
        Host string `toml:"host"`
        Port int64  `toml:"port"`
        Name string `toml:"name"`
        User string `toml:"user"`
        Pass string `toml:"pass"`
    }

    DiscordConfig struct {
        AdminID string `toml:"admin_id" comment:"NOTE: admin_id to be deprecated in favour of local accounts and SSO."`
        ClientID string `toml:"client_id"`
        Secret string `toml:"secret"`
    }

    TwitchConfig struct {
        Broadcaster string `toml:"broadcaster"`
        ClientID string `toml:"client_id"`
        Secret string `toml:"secret"`
    }

    Config struct {
        BaseUrl string `toml:"base_url" comment:"Used for OAuth redirects."`
        Host string `toml:"host"`
        Port int64 `toml:"port"`
        DataDirectory string `toml:"data_dir"`
        TrustedProxies []string `toml:"trusted_proxies"`
        DB DBConfig `toml:"db"`
        Discord *DiscordConfig `toml:"discord"`
        Twitch *TwitchConfig `toml:"twitch"`
    }

    AppState struct {
        DB *sqlx.DB
        Config Config
        Log log.Logger
        Twitch *TwitchState
        PublicFS embed.FS
    }
)
