using Newtonsoft.Json;
using System.Collections.Generic;
using System.ComponentModel;

namespace EliteBGS.Util;

public class AppConfig {
    private static readonly string default_journal_location = "%UserProfile%\\Saved Games\\Frontier Developments\\Elite Dangerous";
    private string journal_location = default_journal_location;
    private string colour = "Amber";
    private string theme = "Dark";

    public static string DefaultJournalLocation => default_journal_location;

    public string LastUsedDiscordTemplate { get; set; }

    public string JournalLocation {
        get {
            if (journal_location == null) {
                return DefaultJournalLocation;
            }
            return journal_location;
        }
        set {
            journal_location = value;
        }
    }

    public string Theme {
        get {
            return theme;
        }
        set {
            if (string.IsNullOrEmpty(value)) {
                theme = "Dark";
            } else {
                theme = value;
            }
        }
    }

    public string Colour {
        get {
            return colour;
        }
        set {
            if (string.IsNullOrEmpty(value)) {
                colour = "Blue";
            } else {
                colour = value;
            }
        }
    }

    /// <summary>
    /// Whether we ignore influence support scenarios form parsing.
    /// </summary>
    public bool IgnoreInfluenceSupport { get; set; } = false;

    /// <summary>
    /// Whether we ignore market buy entries during parsing.
    /// </summary>
    public bool IgnoreMarketBuy { get; set; } = false;

    /// <summary>
    /// Whether to ignore fleet carrier stuff when parsing.
    /// </summary>
    public bool IgnoreFleetCarrier { get; set; } = true;

    /// <summary>
    /// List of Webhooks configured
    /// </summary>
    public List<DiscordWebhook> Webhooks { get; set; } = new List<DiscordWebhook>();

    [JsonIgnore]
    public string FullTheme {
        get { return Theme + "." + Colour; }
    }
}
