local addonName, ns = ...
local L = ns.L or {}

local ASSET_ROOT = "Interface\\AddOns\\" .. tostring(addonName or "Vaultloom") .. "\\Assets\\"

local UIData = ns.UIData or {}
ns.UIData = UIData

UIData.PREMIUM = {
    windowBg = ASSET_ROOT .. "window_bg_reskin.tga",
    windowOverlay = ASSET_ROOT .. "window_overlay_reskin.tga",
    panelBg = ASSET_ROOT .. "panel_bg_reskin.tga",
    panelOverlay = ASSET_ROOT .. "panel_overlay_reskin.tga",
    insetBg = ASSET_ROOT .. "inset_bg_reskin.tga",
    insetOverlay = ASSET_ROOT .. "inset_overlay_reskin.tga",
    heroPlate = ASSET_ROOT .. "hero_plate_reskin.tga",
    cardPlate = ASSET_ROOT .. "card_plate_reskin.tga",
    cardInset = ASSET_ROOT .. "card_inset_reskin.tga",
    sidebarPlate = ASSET_ROOT .. "sidebar_plate_bespoke_v2.tga",
    utilityPlate = ASSET_ROOT .. "utility_plate_bespoke_v2.tga",
    contentPlate = ASSET_ROOT .. "content_plate_bespoke_v2.tga",
    heroPlateBespoke = ASSET_ROOT .. "hero_plate_bespoke_v2.tga",
    buttonNormal = ASSET_ROOT .. "button_reskin_normal.tga",
    buttonHover = ASSET_ROOT .. "button_reskin_hover.tga",
    buttonPressed = ASSET_ROOT .. "button_reskin_pressed.tga",
    tabNormal = ASSET_ROOT .. "tab_reskin_normal.tga",
    tabHover = ASSET_ROOT .. "tab_reskin_hover.tga",
    tabActive = ASSET_ROOT .. "tab_reskin_active.tga",
    row = ASSET_ROOT .. "row_reskin_v2.tga",
    scrollTrack = ASSET_ROOT .. "scroll_track_reskin.tga",
    scrollThumb = ASSET_ROOT .. "scroll_thumb_reskin.tga",
    arrowUp = ASSET_ROOT .. "arrow_up_small.tga",
    arrowDown = ASSET_ROOT .. "arrow_down_small.tga",
    barBg = ASSET_ROOT .. "bar_bg_reskin.tga",
    barFill = ASSET_ROOT .. "bar_fill_reskin.tga",
    barOverlay = ASSET_ROOT .. "bar_overlay_reskin.tga",
    barMarker = ASSET_ROOT .. "bar_marker_reskin.tga",
    barSpark = ASSET_ROOT .. "bar_spark_reskin.tga",
    classBackplate = ASSET_ROOT .. "class_backplate_reskin.tga",
    classRing = ASSET_ROOT .. "class_ring_reskin.tga",
    raidTrackerNone = ASSET_ROOT .. "raid_tracker_none_reskin.tga",
    raidTrackerWish = ASSET_ROOT .. "raid_tracker_wish_reskin.tga",
    raidTrackerObtained = ASSET_ROOT .. "raid_tracker_obtained_reskin.tga",
    statusBadgeComplete = ASSET_ROOT .. "status_badge_complete.tga",
    statusBadgeMissing = ASSET_ROOT .. "status_badge_missing.tga",
    statusBadgeTurnin = ASSET_ROOT .. "status_badge_turnin.tga",
    statusBadgeOpen = ASSET_ROOT .. "status_badge_open.tga",
    statusBadgeRepeatable = ASSET_ROOT .. "status_badge_repeatable.tga",
    statusBadgeLocked = ASSET_ROOT .. "status_badge_locked.tga",
    statusBadgeFailed = ASSET_ROOT .. "status_badge_failed.tga",
    statusBadgeWarning = ASSET_ROOT .. "status_badge_warning.tga",
    statusBadgeUnknown = ASSET_ROOT .. "status_badge_open.tga",
    statusBadgePending = ASSET_ROOT .. "status_badge_pending.tga",
    statusBadgeFrame = ASSET_ROOT .. "status_badge_frame.tga",
    statusBadgeSaltherilFavor = ASSET_ROOT .. "status_badge_saltheril_favor.tga",
    compendiumIconBorder = ASSET_ROOT .. "compendium_icon_border.tga",
    compendiumWaypointIcon = ASSET_ROOT .. "compendium_waypoint_icon.tga",
    compendiumDecorationIcon = ASSET_ROOT .. "compendium_decor_icon.tga",
    renownToastEmblem = ASSET_ROOT .. "renown_toast_emblem.tga",
    renownToastTask = ASSET_ROOT .. "renown_toast_task.tga",
    renownToastLevel = ASSET_ROOT .. "renown_toast_level.tga",
    renownToastRank = ASSET_ROOT .. "renown_toast_rank.tga",
    renownToastWarband = ASSET_ROOT .. "renown_toast_warband.tga",
    minimapLogo = "Interface\\Icons\\Inv_10_gearupgrade_drakesshadowflameenhancedcrest",
}

UIData.PREMIUM.renownBadges = {}
UIData.PREMIUM.renownFrames = {}
UIData.PREMIUM.renownWarbandBadges = {}
for index = 1, 24 do
    UIData.PREMIUM.renownBadges[index] = ASSET_ROOT .. string.format("renown_badge_%02d.tga", index)
    UIData.PREMIUM.renownFrames[index] = ASSET_ROOT .. string.format("renown_frame_%02d.tga", index)
end
for index = 1, 10 do
    UIData.PREMIUM.renownWarbandBadges[index] = ASSET_ROOT .. string.format("renown_warband_badge_%02d.tga", index)
end

UIData.THEME = {
    gold = { 0.92, 0.76, 0.24 },
    goldSoft = { 0.66, 0.52, 0.18 },
    goldDim = { 0.40, 0.31, 0.10 },
    parchment = { 0.93, 0.89, 0.77 },
    charcoal = { 0.05, 0.045, 0.04 },
    metal = { 0.10, 0.09, 0.08 },
    metalDeep = { 0.07, 0.06, 0.055 },
    metalInset = { 0.12, 0.10, 0.085 },
    shadow = { 0.01, 0.01, 0.01 },
    selected = { 0.26, 0.18, 0.08 },
}

UIData.VAULT_ROW_COLORS = {
    raid = { 0.86, 0.42, 0.38 },
    dungeon = { 0.84, 0.69, 0.44 },
    world = { 0.62, 0.84, 0.66 },
}

UIData.GOAL_BAR_COLOR = { 0.68, 0.34, 0.26 }

UIData.STATUS_COLORS = {
    complete = { 0.42, 0.68, 0.44 },
    turnin = { 0.88, 0.68, 0.34 },
    open = { 0.78, 0.70, 0.42 },
    repeatable = { 0.78, 0.70, 0.42 },
    missing = { 0.50, 0.56, 0.66 },
    locked = { 0.36, 0.39, 0.46 },
    failed = { 0.72, 0.16, 0.13 },
    warning = { 0.82, 0.42, 0.12 },
    unknown = { 0.78, 0.70, 0.42 },
    pending = { 0.58, 0.52, 0.72 },
}

UIData.PROFESSION_STATUS_BADGE_TEXTURES = {
    alchemy = ASSET_ROOT .. "status_badge_profession_alchemy.tga",
    blacksmithing = ASSET_ROOT .. "status_badge_profession_blacksmithing.tga",
    enchanting = ASSET_ROOT .. "status_badge_profession_enchanting.tga",
    engineering = ASSET_ROOT .. "status_badge_profession_engineering.tga",
    herbalism = ASSET_ROOT .. "status_badge_profession_herbalism.tga",
    inscription = ASSET_ROOT .. "status_badge_profession_inscription.tga",
    jewelcrafting = ASSET_ROOT .. "status_badge_profession_jewelcrafting.tga",
    leatherworking = ASSET_ROOT .. "status_badge_profession_leatherworking.tga",
    mining = ASSET_ROOT .. "status_badge_profession_mining.tga",
    skinning = ASSET_ROOT .. "status_badge_profession_skinning.tga",
    tailoring = ASSET_ROOT .. "status_badge_profession_tailoring.tga",
}

UIData.RAID_DIFFICULTY_OPTIONS = {
    { key = "lfr", label = function() return L.RAID_DIFFICULTY_LFR or "LFR" end },
    { key = "normal", label = function() return L.RAID_DIFFICULTY_NORMAL or "Normal" end },
    { key = "heroic", label = function() return L.RAID_DIFFICULTY_HEROIC or "Heroic" end },
    { key = "mythic", label = function() return L.RAID_DIFFICULTY_MYTHIC or "Mythic" end },
}

UIData.DUNGEON_DIFFICULTY_OPTIONS = {
    { key = "normal", label = function() return L.RAID_DIFFICULTY_NORMAL or "Normal" end },
    { key = "heroic", label = function() return L.RAID_DIFFICULTY_HEROIC or "Heroic" end },
    { key = "mythic", label = function() return L.DUNGEON_DIFFICULTY_MYTHIC0 or "Mythic 0" end },
}

UIData.RAID_DIFFICULTY_IDS = {
    lfr = 17,
    normal = 14,
    heroic = 15,
    mythic = 16,
}

UIData.DUNGEON_DIFFICULTY_IDS = {
    normal = DIFFICULTY_DUNGEON_NORMAL or 1,
    heroic = DIFFICULTY_DUNGEON_HEROIC or 2,
    mythic = DIFFICULTY_DUNGEON_MYTHIC or 23,
}

UIData.DUNGEON_JOURNAL_SUBTAB_CONFIG = {
    midnight = {
        subTabLabel = function() return L.MAIN_TAB_DUNGEONS_MIDNIGHT or "Midnight" end,
        listSubtitle = function() return L.DUNGEON_JOURNAL_MIDNIGHT_SUBTITLE or "Choose a Midnight dungeon." end,
        fallbackDescription = function()
            return L.DUNGEON_JOURNAL_FALLBACK_DESCRIPTION or "Midnight dungeon entries will appear here once Encounter Journal data is available."
        end,
    },
    season1 = {
        subTabLabel = function() return L.MAIN_TAB_DUNGEONS_SEASON1 or "Season 1" end,
        listSubtitle = function() return L.DUNGEON_JOURNAL_SEASON1_SUBTITLE or "Choose a Season 1 dungeon." end,
        fallbackDescription = function()
            return L.DUNGEON_JOURNAL_SEASON1_FALLBACK_DESCRIPTION or "Season 1 dungeons will appear here once Mythic+ and Encounter Journal data are available."
        end,
    },
}

UIData.SEASONAL_DUNGEON_KEY_GROUPS = {
    ["seat-of-the-triumvirate"] = {
        "seat-of-the-triumvirate",
        "the-seat-of-the-triumvirate",
        "sitz-des-triumvirats",
        "der-sitz-des-triumvirats",
    },
    ["skyreach"] = { "skyreach", "himmelsnadel", "die-himmelsnadel" },
    ["pit-of-saron"] = { "pit-of-saron", "grube-von-saron", "die-grube-von-saron" },
    ["algethar-academy"] = { "algethar-academy", "algeth-ar-academy" },
}

UIData.OFFICIAL_SEASON_ONE_LEGACY_DUNGEON_KEYS = {
    "algethar-academy",
    "pit-of-saron",
    "seat-of-the-triumvirate",
    "skyreach",
}

UIData.MIDNIGHT_RAID_FALLBACK = {
    {
        key = "dreamrift",
        name = "Der Traumriss",
        subtitle = L.RAID_JOURNAL_FALLBACK_SUBTITLE or "Raid journal scaffold",
        description = L.RAID_JOURNAL_FALLBACK_DESCRIPTION or "This first build wires the raid journal layout, state handling, and filters. Live encounter and loot sync can be connected on top of this structure.",
        bosses = {
            {
                key = "journal-sync",
                name = L.RAID_JOURNAL_SYNC_TITLE or "Journal Sync",
                description = L.RAID_JOURNAL_SYNC_DESCRIPTION or "The framework is in place. Live boss names, weekly kill tracking, and full loot sync are the next layer.",
                status = "missing",
                loot = {
                    {
                        name = L.RAID_JOURNAL_LOOT_PENDING or "Loot hookup pending",
                        slot = L.RAID_JOURNAL_LOOT_PENDING_SLOT or "Next step",
                        restriction = L.RAID_JOURNAL_LOOT_PENDING_RESTRICTION or "All classes",
                    },
                },
            },
        },
    },
    {
        key = "voidsreach-spire",
        name = "Die Leerenspitze",
        subtitle = L.RAID_JOURNAL_FALLBACK_SUBTITLE or "Raid journal scaffold",
        description = L.RAID_JOURNAL_FALLBACK_DESCRIPTION or "This first build wires the raid journal layout, state handling, and filters. Live encounter and loot sync can be connected on top of this structure.",
        bosses = {
            {
                key = "journal-sync",
                name = L.RAID_JOURNAL_SYNC_TITLE or "Journal Sync",
                description = L.RAID_JOURNAL_SYNC_DESCRIPTION or "The framework is in place. Live boss names, weekly kill tracking, and full loot sync are the next layer.",
                status = "missing",
                loot = {
                    {
                        name = L.RAID_JOURNAL_LOOT_PENDING or "Loot hookup pending",
                        slot = L.RAID_JOURNAL_LOOT_PENDING_SLOT or "Next step",
                        restriction = L.RAID_JOURNAL_LOOT_PENDING_RESTRICTION or "All classes",
                    },
                },
            },
        },
    },
    {
        key = "march-on-quel-danas",
        name = "Marsch auf Quel'Danas",
        subtitle = L.RAID_JOURNAL_FALLBACK_SUBTITLE or "Raid journal scaffold",
        description = L.RAID_JOURNAL_FALLBACK_DESCRIPTION or "This first build wires the raid journal layout, state handling, and filters. Live encounter and loot sync can be connected on top of this structure.",
        bosses = {
            {
                key = "journal-sync",
                name = L.RAID_JOURNAL_SYNC_TITLE or "Journal Sync",
                description = L.RAID_JOURNAL_SYNC_DESCRIPTION or "The framework is in place. Live boss names, weekly kill tracking, and full loot sync are the next layer.",
                status = "missing",
                loot = {
                    {
                        name = L.RAID_JOURNAL_LOOT_PENDING or "Loot hookup pending",
                        slot = L.RAID_JOURNAL_LOOT_PENDING_SLOT or "Next step",
                        restriction = L.RAID_JOURNAL_LOOT_PENDING_RESTRICTION or "All classes",
                    },
                },
            },
        },
    },
}

UIData.MIDNIGHT_DUNGEON_FALLBACK = {
    {
        key = "midnight-dungeons",
        name = L.DUNGEONS or "Dungeons",
        subtitle = L.RAID_JOURNAL_SOURCE_EJ or "Encounter Journal",
        description = L.DUNGEON_JOURNAL_FALLBACK_DESCRIPTION or "Midnight dungeon entries will appear here once Encounter Journal data is available.",
        bosses = {
            {
                key = "journal-sync",
                name = L.RAID_JOURNAL_SYNC_TITLE or "Journal Sync",
                description = L.RAID_JOURNAL_SYNC_DESCRIPTION or "The framework is in place. Live boss names, weekly kill tracking, and full loot sync are the next layer.",
                status = "missing",
                loot = {
                    {
                        name = L.RAID_JOURNAL_LOOT_PENDING or "Loot hookup pending",
                        slot = L.RAID_JOURNAL_LOOT_PENDING_SLOT or "Next step",
                        restriction = L.RAID_JOURNAL_LOOT_PENDING_RESTRICTION or "All classes",
                    },
                },
            },
        },
    },
}

UIData.MAIN_TABS = {
    { key = "vault", label = function() return L.MAIN_TAB_VAULT or "Vault" end },
    { key = "pve", label = function() return L.MAIN_TAB_PVE or "PvE" end },
    { key = "pvp", label = function() return L.MAIN_TAB_PVP or "PvP" end },
    { key = "systems", label = function() return L.MAIN_TAB_SYSTEMS or "Systems" end },
    { key = "raids", label = function() return L.RAIDS or "Raids" end },
    { key = "dungeons", label = function() return L.DUNGEONS or "Dungeons" end },
    { key = "mythicplus", label = function() return L.MAIN_TAB_MYTHICPLUS or "Mythic+" end },
    { key = "housing", label = function() return L.MAIN_TAB_HOUSING or "Housing" end },
    { key = "focus", label = function() return L.MAIN_TAB_FOCUS or "Fokus" end },
    { key = "chronicle", label = function() return L.MAIN_TAB_CHRONICLE or "Chronik" end },
    { key = "compendium", label = function() return L.MAIN_TAB_COMPENDIUM or "Kompendium" end },
}

UIData.SUB_TABS = {
    vault = {
        { key = "raids", label = function() return L.SUBTAB_VAULT_RAIDS or "Raids" end },
        { key = "dungeons", label = function() return L.SUBTAB_VAULT_DUNGEONS or "Dungeons" end },
        { key = "world", label = function() return L.SUBTAB_VAULT_WORLD or "World / Delves / Prey" end },
    },
    raids = {
        { key = "midnight", label = function() return L.MAIN_TAB_RAIDS_MIDNIGHT or "Midnight" end },
    },
    dungeons = {
        { key = "midnight", label = function() return L.MAIN_TAB_DUNGEONS_MIDNIGHT or "Midnight" end },
        { key = "season1", label = function() return L.MAIN_TAB_DUNGEONS_SEASON1 or "Season 1" end },
    },
    mythicplus = {
        { key = "season1", label = function() return L.SUBTAB_MYTHICPLUS_SEASON1 or "Season 1" end },
    },
    housing = {
        { key = "endeavors", label = function() return L.SUBTAB_HOUSING_ENDEAVORS or "Endeavors" end },
    },
    focus = {
        { key = "questboard", label = function() return L.SUBTAB_FOCUS_QUESTBOARD or "Questboard" end },
    },
    chronicle = {
        { key = "overview", label = function() return L.SUBTAB_CHRONICLE_OVERVIEW or "Overview" end },
    },
    pve = {
        { key = "weekly", label = function() return L.SUBTAB_PVE_WEEKLY or "Weekly" end },
        { key = "daily", label = function() return L.SUBTAB_PVE_DAILY or "Daily" end },
        { key = "events", label = function() return L.SUBTAB_PVE_EVENTS or "Events" end },
        { key = "delves", label = function() return L.SUBTAB_PVE_DELVES or "Delves" end },
        { key = "prey", label = function() return L.SUBTAB_PVE_PREY or "Prey" end },
        { key = "rares", label = function() return L.SUBTAB_PVE_RARES or "Rare mobs" end },
        { key = "world", label = function() return L.SUBTAB_PVE_WORLD or "World" end },
        {
            key = "special-heading",
            heading = true,
            label = function() return L.SUBTAB_PVE_SPECIAL or "Special" end,
            visible = function()
                return ns.IsDarkmoonFaireActive and ns:IsDarkmoonFaireActive() or false
            end,
        },
        {
            key = "darkmoon",
            label = function() return L.SUBTAB_PVE_DARKMOON or "Darkmoon" end,
            visible = function()
                return ns.IsDarkmoonFaireActive and ns:IsDarkmoonFaireActive() or false
            end,
        },
    },
    pvp = {
        { key = "weekly", label = function() return L.SUBTAB_PVP_WEEKLY or "Weekly" end },
    },
    systems = {
        { key = "professions", label = function() return L.SUBTAB_SYSTEMS_PROFESSIONS or "Professions" end },
        { key = "cooldowns", label = function() return L.SUBTAB_SYSTEMS_PROFESSION_COOLDOWNS or "Cooldowns" end },
    },
}

UIData.VAULT_ROW_MAP = {
    raids = "raid",
    dungeons = "dungeon",
    world = "world",
}

UIData.WISHLIST_FILTERS = {
    { key = "all", label = function() return L.WISHLIST_FILTER_ALL or "All" end },
    { key = "raids", label = function() return L.WISHLIST_FILTER_RAIDS or "Raids" end },
    { key = "dungeons", label = function() return L.WISHLIST_FILTER_DUNGEONS or "Dungeons" end },
}

UIData.WISHLIST_CONTENT_SORT_ORDER = {
    raids = 1,
    dungeons = 2,
}

UIData.HOUSING_COMMUNITY_COUPONS_CURRENCY_ID = 3363
UIData.HOUSING_REQUEST_COOLDOWN = 2.5

UIData.UI_LAYOUT = {
    frameDefaultWidth = 1410,
    frameDefaultHeight = 760,
    mythicPlusSummaryPanelHeight = 136,
    mythicPlusKeyPanelHeight = 128,
    mythicPlusStatCardHeight = 64,
    housingSummaryPanelHeight = 196,
    housingHomePanelHeight = 168,
    housingMilestonesPanelHeight = 168,
    housingStatCardHeight = 64,
    housingTaskRowHeight = 48,
    housingTaskRowGap = 10,
}

UIData.WEEKLY_STATUS_ROW_HEIGHT = 34
UIData.WEEKLY_STATUS_ROW_GAP = 8
UIData.WEEKLY_STATUS_BADGE_SIZE = 22

UIData.SIDEBAR_SORT_OPTIONS = {
    { key = "name", label = function() return L.SIDEBAR_SORT_NAME or "Name" end, width = 64 },
    { key = "level", label = function() return L.SIDEBAR_SORT_LEVEL or "Level" end, width = 64 },
    { key = "itemLevel", label = function() return L.SIDEBAR_SORT_ITEM_LEVEL or "iLvl" end, width = 56 },
    { key = "priority", label = function() return L.SIDEBAR_SORT_PRIORITY or "Score" end, width = 64 },
}
