package main

// config struct
type UsrConfig struct {
	Server struct { // server specific settings
		ServDir   string `yaml:"serverFolder"`
		WorldFile string `yaml:"worldFile"`
		ServCfg   string `yaml:"serverSettings"`
		ServExec  string `yaml:"serverExec"`
		ServPort  int    `yaml:"port"`
	} `yaml:"server"`

	Factoryman struct { // factoryman settings
		BackupDir  string `yaml:"backupDir"`
		UseScreen  bool   `yaml:"screen"`
		ScreenName string `yaml:"screenName"`
		UserName   string `yaml:"username"`
		ApiToken   string `yaml:"apitoken"`
	} `yaml:"factoryman"`
}

type DefConfig struct {
	Server struct { // server specific settings
		ServDir   string
		WorldFile string
		ServCfg   string
		ServExec  string
		ServPort  int
	}

	Factoryman struct { // factoryman settings
		BackupDir  string
		UseScreen  bool
		ScreenName string
		UserName   string
		ApiToken   string
	}
}

// JSON file from config
type Mod struct {
	Name    string `json:"name"`
	Enabled bool   `json:"enabled"`
	Version string `json:"version,omitempty"`
}

type ModList struct {
	Mods []Mod `json:"mods"`
}

// JSON response from mod poartal api
type ModPortal struct {
	Category      string    `json:"category"`
	DownloadCount int       `json:"downloads_count"`
	Name          string    `json:"name"`
	Owner         string    `json:"owner"`
	Releases      []Release `json:"releases"`
	Score         float64   `json:"score"`
	Summary       string    `json:"summary"`
	Thumbnail     string    `json:"thumbnail"`
	Title         string    `json:"title"`
}

type Release struct {
	DownloadUrl string   `json:"download_url"`
	Filename    string   `json:"file_name"`
	InfoJson    InfoJSON `json:"info_json"`
	ReleaseTime string   `json:"released_at"`
	Sha1        string   `json:"sha1"`
	Version     string   `json:"version"`
}

type InfoJSON struct {
	Dependencies    []string `json:"dependencies"`
	FactorioVersion string   `json:"factorio_version"`
}
