package main

import "sort"

var (
	Bookmarks = []Bookmark{
		{
			Title: "DuckDuckGo",
			Image: "https://duckduckgo.com/assets/logo_homepage.alt.v108.svg",
			Color: "#1c1c1c",
			Link:  "https://duckduckgo.com/",
		},
		{
			Title: "Postbank",
			Image: "https://meine.postbank.de/bundles/@pbs/patternlib_pb/lib/runtime/assets/images/logo-claim.svg",
			Color: "#ffcc00",
			Link:  "https://meine.postbank.de/#/login",
		},
		{
			Title: "YouTube",
			Image: "https://upload.wikimedia.org/wikipedia/commons/1/1f/YouTube_light_logo_%282017%29.svg",
			Color: "#ff0000",
			Link:  "https://www.youtube.com/",
		},
		{
			Title: "Jisho",
			Image: "https://assets.jisho.org/assets/jisho-logo-v4@2x-7330091c079b9dd59601401b052b52e103978221c8fb6f5e22406d871fcc746a.png",
			Link:  "https://jisho.com/",
			Color: "#ffffff",
		},
		{
			Title: "Wadoku",
			Image: "https://www.wadoku.de/img/wadoku_logo.svg",
			Link:  "https://www.wadoku.de/",
			Color: "#ffffff",
		},
		{
			Title: "Übersetzer",
			Image: "https://static.deepl.com/img/logo/DeepL_Logo_darkBlue_v2.svg",
			Link:  "https://www.deepl.com/translator",
			Color: "#ffffff",
		},
		{
			Title: "WaniKani",
			Image: "https://assets.wanikani.com/assets/logo--retro-colors-b79775af8773b5a416e4ec3fae02e62d391b7e88e57f9fe0c2e4997a3383b002.png",
			Link:  "https://www.wanikani.com/",
			Color: "#ffffff",
		},
		{
			Title: "Passwörter",
			Image: "https://raw.githubusercontent.com/dani-garcia/vaultwarden/main/resources/vaultwarden-logo-white.svg",
			Link:  "https://pw.tordarus.net",
			Color: "#175ddc",
		},
		{
			Title: "Projekte",
			Image: "https://git.tordarus.net/assets/img/logo.svg",
			Link:  "https://git.tordarus.net",
			Color: "#383c4a",
		},
		{
			Title: "Wikipedia",
			Image: "https://upload.wikimedia.org/wikipedia/commons/8/80/Wikipedia-logo-v2.svg",
			Link:  "https://www.wikipedia.org/",
			Color: "#ffffff",
		},
		{
			Title: "Reddit",
			Image: "https://www.redditinc.com/assets/images/site/reddit-logo.png",
			Link:  "https://www.reddit.com/",
			Color: "#ff4300",
		},
		{
			Title: "Tagesschau",
			Image: "https://m47ch.com/wp-content/uploads/2010/12/Tagesschau.png",
			Link:  "https://www.golem.de/",
			Color: "#003f8c",
		},
		{
			Title: "Golem",
			Image: "https://www.golem.de/staticrl/images/golem-logo-opt2.svg",
			Link:  "https://www.golem.de/",
			Color: "#000000",
		},
		{
			Title:       "Comico",
			Image:       "https://play-lh.googleusercontent.com/xZ5bfg-XfyEmM1641bXduE27w44OmyWeVspg626wRYF0ejAgZAvsRKP4sECblfmnpg=w512",
			ImageSize:   "cover",
			IconPadding: "0em",
			Link:        "https://comico.jp/",
			Color:       "#f40000",
		},
		{
			Title: "Manganelo",
			Image: "https://manganato.com/themes/hm/images/logo.png",
			Link:  "https://manganato.com/",
			Color: "#ffffff",
		},
	}
)

type Bookmark struct {
	Title       string
	Image       string
	ImageSize   string
	IconPadding string
	Color       string
	Link        string
	HideBorder  bool
	Order       int
}

func ParseBookmarks() {
	// set default values
	for i := range Bookmarks {
		if Bookmarks[i].Color == "" {
			Bookmarks[i].Color = DefaultSettings.Background
		}
		if Bookmarks[i].ImageSize == "" {
			Bookmarks[i].ImageSize = "contain"
		}
	}

	sort.SliceStable(Bookmarks, func(i, j int) bool {
		return Bookmarks[i].Order < Bookmarks[j].Order
	})
}
