package mods

import "time"

type ModInfo struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Version  string `json:"version"`
	Filename string `json:"filename"`
	Enabled  bool   `json:"enabled"`
	Source   string `json:"source"`
}

type ScanResponse struct {
	Variant          string    `json:"variant"`
	MinecraftVersion string    `json:"minecraft_version,omitempty"`
	VariantVersion   string    `json:"variant_version,omitempty"`
	Mods             []ModInfo `json:"mods"`
	TotalCount       int       `json:"total_count"`
	ScanTimestamp    string    `json:"scan_timestamp"`
}

type InstallRequest struct {
	Source       string `json:"source"`
	ModID        string `json:"mod_id"`
	Version      string `json:"version"`
	ArtifactURL  string `json:"artifact_url"`
	ArtifactHash string `json:"artifact_hash"`
	DownloadURL  string `json:"download_url"`
	Filename     string `json:"filename"`
	SHA512       string `json:"sha512"`
	SHA1         string `json:"sha1"`
}

type ActionResponse struct {
	Success         bool   `json:"success"`
	Action          string `json:"action"`
	RestartRequired bool   `json:"restart_required"`
}

type PatchRequest struct {
	Enabled bool `json:"enabled"`
}

type cacheEntry struct {
	ExpiresAt time.Time
	Resp      ScanResponse
}
