using System.IO.Compression;

namespace Luski.Classes;

public static class LuskiThemes
{
    public static void LoadThemeFromDir(string dir)
    {
        ThemeStart ts = Globals.GetSettings(Path.Combine(dir, "theme.json"), ThemeStartContext.Default.ThemeStart);
        LuskiThemes.LuskiThemeList.Add(ts);
    }
    
    public static void LoadThemeFromZip(string ZIP)
    {
        ZipArchive zf = ZipFile.OpenRead(ZIP);
        ZipArchiveEntry? json = zf.GetEntry("theme.json");
        ThemeStart ts = Globals.GetSettings(json?.Open()!, ThemeStartContext.Default.ThemeStart);
        LuskiThemes.LuskiThemeList.Add(ts);
    }
    

    public readonly static ThemeStart Dark = new()
    {
        Name = "Dark",
        Description = "A dark theme but still a bit lit."
    };
    public static ThemeStart Amoled = new()
    {
        Name = "Amoled",
        Description = "A dark theme that is truly dark."
    };
    public static ThemeStart Light = new()
    {
        Name = "Light",
        Description = "A light theme for the insane.",
        GlobalServerTemplate = new()
        {
            SelectionColor = new("000000")
        }
    };
    
    public static List<ThemeStart> LuskiThemeList = new()
    {
        Light,
        Dark,
        Amoled
    };
}