-- VDS_Constants
-- ============================================================================
-- Closed action taxonomy + master configuration constants.
-- Every ACTIONS entry must have an ActionMeta row (boot validator enforces this).

VDS = VDS or {}
VDS.Constants = VDS.Constants or {}

VDS.Constants.ADDON_NAME = "VamoosesDyeStudio"
VDS.Constants.SAVEDVAR_KEY = "VDS_DB"

-- Closed action taxonomy. The reducer's only valid input shapes.
VDS.Constants.ACTIONS = {
    -- ===== Engine =====
    MAIN_WINDOW_TOGGLE     = "VDS_MAIN_WINDOW_TOGGLE",
    MAIN_WINDOW_SHOW       = "VDS_MAIN_WINDOW_SHOW",
    MAIN_WINDOW_HIDE       = "VDS_MAIN_WINDOW_HIDE",
    MAIN_CONFIG_TOGGLE     = "VDS_MAIN_CONFIG_TOGGLE",
    CONFIG_SET             = "VDS_CONFIG_SET",
    HARD_RESET             = "VDS_HARD_RESET",
    BAG_TICK               = "VDS_BAG_TICK",
    ITEM_NAME_RESOLVED     = "VDS_ITEM_NAME_RESOLVED",
    ITEM_NAMES_BATCH_RESOLVED = "VDS_ITEM_NAMES_BATCH_RESOLVED",  -- debounced batch of resolutions
    SESSION_IDENTITY_SET   = "VDS_SESSION_IDENTITY_SET",

    -- ===== Filter / mode =====
    SET_FILTER_MODE        = "VDS_SET_FILTER_MODE",
    SET_SEARCH_TEXT        = "VDS_SET_SEARCH_TEXT",
    SET_OWNED_ONLY         = "VDS_SET_OWNED_ONLY",
    SET_REPLACE_BLIZZARD   = "VDS_SET_REPLACE_BLIZZARD",
    SET_ACTIVE_TAB         = "VDS_SET_ACTIVE_TAB",
    SET_ACTIVE_SUBFILTER   = "VDS_SET_ACTIVE_SUBFILTER",
    SET_HERB_SORT_MODE     = "VDS_SET_HERB_SORT_MODE",
    SET_SELECTED_DYE       = "VDS_SET_SELECTED_DYE",
    SET_SELECTED_HERB      = "VDS_SET_SELECTED_HERB",

    -- ===== Custom themes =====
    CUSTOM_THEME_CREATE       = "VDS_CUSTOM_THEME_CREATE",
    CUSTOM_THEME_DELETE       = "VDS_CUSTOM_THEME_DELETE",
    CUSTOM_THEME_RENAME       = "VDS_CUSTOM_THEME_RENAME",
    CUSTOM_THEME_EDIT_START   = "VDS_CUSTOM_THEME_EDIT_START",
    CUSTOM_THEME_EDIT_END     = "VDS_CUSTOM_THEME_EDIT_END",
    CUSTOM_THEME_TOGGLE_DYE   = "VDS_CUSTOM_THEME_TOGGLE_DYE",

    -- ===== Canvas =====
    CANVAS_SET_DECOR             = "VDS_CANVAS_SET_DECOR",
    CANVAS_SET_CHANNEL_DYE       = "VDS_CANVAS_SET_CHANNEL_DYE",
    CANVAS_CLEAR_CHANNEL         = "VDS_CANVAS_CLEAR_CHANNEL",
    CANVAS_RANDOM                = "VDS_CANVAS_RANDOM",
    CANVAS_SET_ACTIVE_CHANNEL    = "VDS_CANVAS_SET_ACTIVE_CHANNEL",
    CANVAS_CYCLE_ACTIVE_CHANNEL  = "VDS_CANVAS_CYCLE_ACTIVE_CHANNEL",
    CANVAS_SET_PICKER_MODE       = "VDS_CANVAS_SET_PICKER_MODE",
    CANVAS_SET_PICKER_SEARCH     = "VDS_CANVAS_SET_PICKER_SEARCH",
    CANVAS_SAVE_LOADOUT          = "VDS_CANVAS_SAVE_LOADOUT",
    CANVAS_DELETE_LOADOUT        = "VDS_CANVAS_DELETE_LOADOUT",
    CANVAS_RENAME_LOADOUT        = "VDS_CANVAS_RENAME_LOADOUT",
    CANVAS_AUTOSAVE_SET          = "VDS_CANVAS_AUTOSAVE_SET",
    CANVAS_PREVIEW_DETACH_SET    = "VDS_CANVAS_PREVIEW_DETACH_SET",
    -- CANVAS_TOGGLE_EXPAND retired in Phase 5 (tree removed; no expand state).
    CANVAS_APPLY_LOADOUT         = "VDS_CANVAS_APPLY_LOADOUT",
    CANVAS_SET_SCOPE             = "VDS_CANVAS_SET_SCOPE",
    CANVAS_SET_CATEGORY          = "VDS_CANVAS_SET_CATEGORY",
    CANVAS_HARMONISE             = "VDS_CANVAS_HARMONISE",

    -- ===== Live mode =====
    LIVE_MODE_ENTER              = "VDS_LIVE_MODE_ENTER",
    LIVE_MODE_EXIT               = "VDS_LIVE_MODE_EXIT",
    LIVE_SLOTS_UPDATE            = "VDS_LIVE_SLOTS_UPDATE",
    LIVE_SET_SLOT_DYE_INTENT     = "VDS_LIVE_SET_SLOT_DYE_INTENT",
    LIVE_SLOT_FOCUS_SET          = "VDS_LIVE_SLOT_FOCUS_SET",
    LIVE_RECENT_DYE_ADD          = "VDS_LIVE_RECENT_DYE_ADD",
    LIVE_AUTOSAVE_SET            = "VDS_LIVE_AUTOSAVE_SET",
    LIVE_COST_UPDATE             = "VDS_LIVE_COST_UPDATE",
    LIVE_COMMIT_SNAPSHOT         = "VDS_LIVE_COMMIT_SNAPSHOT",  -- re-snapshot originalDyes from current slots post-commit

    -- ===== Ownership + scan =====
    OWNERSHIP_TICK               = "VDS_OWNERSHIP_TICK",
    DYEABLE_ITEMS_UPDATE         = "VDS_DYEABLE_ITEMS_UPDATE",
    DYE_DATA_INIT                = "VDS_DYE_DATA_INIT",

    -- ===== Catalog (ADR-001 amendment) =====
    CATALOG_READY                = "VDS_CATALOG_READY",
    CANVAS_CATALOG_UPDATE        = "VDS_CANVAS_CATALOG_UPDATE",
    CATALOG_STATUS_SET           = "VDS_CATALOG_STATUS_SET",

    -- ===== Window + minimap =====
    PANEL_POSITION_SAVE          = "VDS_PANEL_POSITION_SAVE",
    MINIMAP_HIDE_SET             = "VDS_MINIMAP_HIDE_SET",
    MINIMAP_POSITION_SAVE        = "VDS_MINIMAP_POSITION_SAVE",

    -- ===== Warehouse / Stock =====
    STOCK_TICK                  = "STOCK_TICK",
    STOCK_SET_GROUP_TARGET      = "STOCK_SET_GROUP_TARGET",
    STOCK_BUMP_ALL_GROUPS       = "STOCK_BUMP_ALL_GROUPS",
    STOCK_RESET_ALL_TARGETS     = "STOCK_RESET_ALL_TARGETS",
    STOCK_SET_DYE_TARGET        = "STOCK_SET_DYE_TARGET",
    STOCK_RESET_DYE_OVERRIDE    = "STOCK_RESET_DYE_OVERRIDE",
    STOCK_SET_FILL_MODE         = "STOCK_SET_FILL_MODE",
    STOCK_SET_BUY_GAP           = "STOCK_SET_BUY_GAP",
    STOCK_TOGGLE_GROUP          = "STOCK_TOGGLE_GROUP",
    STOCK_COLLAPSE_ALL_GROUPS   = "STOCK_COLLAPSE_ALL_GROUPS",
    STOCK_EXPAND_ALL_GROUPS     = "STOCK_EXPAND_ALL_GROUPS",
}

VDS.Constants.LIVE_RECENT_DYES_MAX = 12  -- strip width: marker 20 + 12*28 + 11*2 = 378 <= 404 avail (420 panel - 2*8 pad)

-- Dyeable decor that resolve + preview-dye fine by recordID but aren't yet
-- available to collect (upcoming/unreleased -- not in the shop). Surfaced in the
-- Canvas picker for ALL players as a sneak peek, so dye combos can be previewed
-- ahead of release. Currently the Lunar Celebrant's set (the Auspicious set
-- resolves but doesn't actually preview, so it stays debug-only).
VDS.Constants.ALWAYS_APPEND_DECOR = {
    [9265] = true,  -- Lunar Celebrant's Aquarium
    [9270] = true,  -- Lunar Celebrant's Cradle
    [9271] = true,  -- Lunar Celebrant's Wide Pillow Roll
    [9273] = true,  -- Lunar Celebrant's Privacy Screen
    [9274] = true,  -- Lunar Celebrant's Ornate Vanity
}

-- Donor parity (VDS_DyePanel.lua / VDS_DyeDetail.lua)
VDS.Constants.HERB_SORT_MODES_CYCLE = { "Expac", "Price Low", "Price High" }
VDS.Constants.OWNERSHIP_DEBOUNCE = 0.5  -- BAG_UPDATE debounce (seconds)

-- Lifted from donor VDS.CONFIG.FLOATING_WIDGET (cookbook 15 rule 8).
-- LayoutConfig drives most positioning; per-row HEIGHTS come from here for donor-path compat.
VDS.Constants.FLOATING_WIDGET = {
    HEADER_HEIGHT             = 34,
    HEADER_BTN_SIZE           = 24,
    HEADER_BTN_GAP            = 4,
    HEADER_BTN_MARGIN         = 6,
    PANEL_MARGIN              = 6,
    PANEL_GAP                 = 4,
    PANEL_PADDING             = 12,
    FOOTER_PADDING            = 8,
    SECTION_HEADER_HEIGHT     = 22,
    ROW_HEIGHT                = 18,
    DYE_PANEL_WIDTH           = 420,
    DYE_PANEL_HEIGHT          = 520,
    DYE_SWATCH_SIZE           = 18,
    DYE_SWATCH_SPACING        = 2,
    DYE_PALETTE_STRIP_HEIGHT  = 24,
    DYE_MAX_CUSTOM_THEMES     = 20,
    DYE_MAX_DYES_PER_THEME    = 20,
    CANVAS_MAX_LOADOUTS_PER_DECOR = 10,
    DYE_ROW_HEIGHT            = 36,
    DYE_HERB_ROW_HEIGHT       = 21,
    DYE_ROW_GAP               = 2,
    DYE_SWATCH_RATIO          = 0.55,
    DYE_HEADER_HEIGHT         = 22,
    DYE_TAB_HEIGHT            = 26,
    DYE_CHIP_HEIGHT           = 24,
    DYE_CHIP_GAP              = 4,
    DYE_DETAIL_STRIP_HEIGHT   = 52,
}

VDS.Constants.TEXTURES = {
    WHITE = "Interface\\Buttons\\WHITE8x8",
}

-- Blizzard atlas names. Centralized: a typo in one site produces a runtime error,
-- not a silent invisible texture. Multi-file names live here.
VDS.Constants.ATLAS = {
    DYE_DROP             = "dye-drop_32",
    CLOSE_X              = "XMarksTheSpot",
    DYE_SWATCH_BASE      = "Housing_Customize_Dye_Swatch_Base",
    DYE_SWATCH_GRADIENT  = "Housing_Customize_Dye_Swatch_Gradient",
    DYE_SWATCH_EMPTY     = "housing_customize_dye_swatch_empty",
    DYE_FRAME_DEFAULT    = "Housing_Customize_Dye_Frame_Default",
    DYE_FRAME_SELECTED   = "Housing_Customize_Dye_Frame_Selected",
    TREE_HEADER_EXPAND   = "Soulbinds_Collection_CategoryHeader_Expand",
    TREE_HEADER_COLLAPSE = "Soulbinds_Collection_CategoryHeader_Collapse",
    -- Transmog revert arrow; used on dye-row override-reset affordance.
    RESET_REVERT          = "transmog-icon-revert-small",
    RESET_REVERT_DISABLED = "transmog-icon-revert-small-disabled",
}

-- Scheme-invariant color escape codes (|cffRRGGBB for print/SetText/tooltips).
-- Theme:ColorCode("token") handles scheme-aware paints; these are baked-in brand tokens.
-- RESET = "|r" for concat: print(C.gold .. "x10" .. C.reset)
VDS.Constants.COLOR_CODE = {
    gold        = "|cfffcd34d",   -- slash commands, label-token highlight (most-used)
    warn        = "|cffffcc55",   -- attention / caution
    brandTeal   = "|cff14b8a6",   -- VDS brand accent
    dim         = "|cff7a7a7a",   -- secondary text
    placeholder = "|cffaaaaaa",   -- loading / empty-state placeholders
    success     = "|cff86c97c",   -- positive feedback (in cart / stock)
    slash       = "|cffaad5ff",   -- /vds command listing
    info        = "|cffffb060",   -- info-tag traces
    reset       = "|r",
}

-- Chat-print brand prefix: "[VDS]" in brand teal. Single definition so Find/Replace touches one place.
VDS.Constants.CHAT_PREFIX = VDS.Constants.COLOR_CODE.brandTeal
                          .. "[VDS]"
                          .. VDS.Constants.COLOR_CODE.reset
