-- Copyright © 2024 @Groick (Twitch). All rights reserved.
-- IMPORTANT: External addons should never modify the values of variables in this file.
local function L(key, ...) return EasyOptions:Localize(key, ...) end

EasyOptions.Libs = {}
EasyOptions.Libs.DataBroker = LibStub("LibDataBroker-1.1")
EasyOptions.Libs.DBIcon = LibStub("LibDBIcon-1.0")

EasyOptions.Current = {} -- Stores parameters for the addon or item that is currently being built.
EasyOptions.Current.AddonName = nil -- Stores the name of the addon that is currently having its Options frame(s) built.
EasyOptions.Current.AddonDB = nil -- Stores the database of the addon that is currently having its Options frame(s) built.
EasyOptions.Current.OptionItemIndex = 0 -- Stores the index of EasyOptions.Current.OptionItem in EasyOptions.Current.OptionItems.
EasyOptions.Current.OptionItem = nil -- Stores the OptionItem of the current control or command.
EasyOptions.Current.OptionItemsParent = nil -- Stores all option items for the current Addon, including the child items. -- [1] Name, [2] Text, [3] TooltipText, [4] PositionInfo, [5] Type, [6+] [Type Specific]
EasyOptions.Current.OptionItems = nil -- Stores the OptionItems of the Options frame that is currently being built (e.g., EasyOptions.Current.OptionItemsParent or EasyOptions.Current.OptionItemsParent.Children[i]).
EasyOptions.Current.OptionItemsDictionary = nil -- Stores all items in EasyOptions.Current.OptionItemsParent as a dictionary. [OptionName] = [1] OptionItem
EasyOptions.Current.OptionControls = nil -- Stores the controls that are associated with each item in EasyOptions.Current.OptionItemsParent. [OptionName] = [1] Control
EasyOptions.Current.OptionControlCounts = nil -- Stores the number of each control type that was created for the current Addon. [ControlType] = [1] Count
EasyOptions.Current.IsBuildingOptionFrame = false -- Indicates whether an Options frame is currently being built.

EasyOptions.Fields = {}
EasyOptions.Fields.AddonInfo = {} -- [AddonName] = {AddonName, AddonDB, OptionItems, OptionItemsDictionary, MainOptionPanelFrame, OptionPanelFrames, OptionControls, OptionControlCounts, OnOptionValueChangedHandler (Optional), OnOptionValuesChangingHandler (Optional), OnOptionValuesChangedHandler (Optional), OnOptionValuesChangedHandler (Optional), OnOptionPanelFrameShowHandler (Optional), IsValidSaveDataVersionProvider (Optional)} -- Stores all data for each addon.

EasyOptions.Fields.RadioButtonGroups = {} -- ["RadioButtonGroupName"] = {RadioButtons}
EasyOptions.Fields.RadioButtonDefaultGroupIndex = 0

EasyOptions.Fields.DefaultUseDefaultLimitValuesIfNoCustomLimitValues = true

EasyOptions.Fields.DefaultScrollBarRegionWidth = 20
EasyOptions.Fields.DefaultWidthMaxAvailable_NoScrollBars = (643 - 4) - (2 * 6) -- EasyOptions:GetDefaultControlMarginX() -- Specifies the maximum recommended width of a control that does not include a scroll bar to the right of the control (e.g., a GroupBox).
EasyOptions.Fields.DefaultWidthMaxAvailable_WithScrollBars = EasyOptions.Fields.DefaultWidthMaxAvailable_NoScrollBars - EasyOptions.Fields.DefaultScrollBarRegionWidth -- Specifies the maximum recommended width of a control that includes a scroll bar to the right of the control (e.g., a MultiLineTextBox).
EasyOptions.Fields.DefaultOffScreenPosition = 10000
EasyOptions.Fields.ControlSizeMaxAllowed_Large = 10000

EasyOptions.Fields.FillWidthFlag = "Fill" -- Specifies the flag that indicates that a control's width should fill the available space of the parent control.
EasyOptions.Fields.AssumeNegativeWidthIsFillWidthFlag = false -- Indicates whether a negative value for the width should correspond to EasyOptions.Fields.FillWidthFlag.

EasyOptions.Fields.OptionsFrameMarginLeft = 8 -- Specifies how far our options frame is from the corresponding edge of the WoW options panel.
EasyOptions.Fields.OptionsFrameMarginTop = 8 -- Specifies how far our options frame is from the corresponding edge of the WoW options panel.
EasyOptions.Fields.OptionsFrameMarginRight = 5 -- Specifies how far our options frame is from the corresponding edge of the WoW options panel.
EasyOptions.Fields.OptionsFrameMarginBottom = 8 -- Specifies how far our options frame is from the corresponding edge of the WoW options panel.
EasyOptions.Fields.ScrollBarVerticalMargin = 4 -- Specifies how far the scroll bars are from the top and bottom of the frame that contains the controls.

EasyOptions.Fields.FramePositionValueStep = 0.1
EasyOptions.Fields.FramePositionRoundIncrement = 0.01 * EasyOptions.Fields.FramePositionValueStep
EasyOptions.Fields.FramePositionRoundFormatString = "%.1f"
EasyOptions.Fields.FrameSizeValueStep = 1.0
EasyOptions.Fields.FrameSizeRoundIncrement = 0.01 * EasyOptions.Fields.FrameSizeValueStep
EasyOptions.Fields.FrameSizeRoundFormatString = "%i"
EasyOptions.Fields.FrameScaleValueStep = 0.01
EasyOptions.Fields.FrameScaleRoundIncrement = 0.01 * EasyOptions.Fields.FrameScaleValueStep
EasyOptions.Fields.FrameScaleRoundFormatString = "%.2f"
EasyOptions.Fields.FrameLevelValueStep = 1.0
EasyOptions.Fields.FrameLevelRoundIncrement = EasyOptions.Fields.FrameLevelValueStep
EasyOptions.Fields.FrameLevelRoundFormatString = "%i"

EasyOptions.Fields.FrameForResetFramePosition = nil -- See EasyOptions:ResetFramePosition for why this field is required.

EasyOptions.Fields.DefaultTitleColor = {(255 / 255), (209 / 255), (0 / 255)} -- NORMAL_FONT_COLOR
EasyOptions.Fields.DefaultHighlightColor = EasyOptions.Fields.DefaultTitleColor -- See also EasyOptionsDB["ControlHighlightColor"].
EasyOptions.Fields.DefaultTextColor = {(255 / 255), (255 / 255), (255 / 255)}
EasyOptions.Fields.DefaultAlternateTextColor = {(237 / 255), (165 / 255), (95 / 255)}
EasyOptions.Fields.DefaultPrintTextColor = {(255 / 255), (255 / 255), (255 / 255)}
EasyOptions.Fields.DefaultGeneralMessageColor = {(255 / 255), (255 / 255), (170 / 255)} -- (86 / 255), (156 / 255), (255 / 255)
EasyOptions.Fields.DefaultErrorMessageColor = {(241 / 255), (99 / 255), (99 / 255)} -- (237 / 255), (61 / 255), (61 / 255) -- (255 / 255), (96 / 255), (96 / 255)

EasyOptions.Fields.DefaultSoundFileInfos = { 
  {"Interface\\AddOns\\EasyOptions\\Sounds\\Ding 1.mp3", L("Ding 1")}, 
  {"Interface\\AddOns\\EasyOptions\\Sounds\\Ding 2.mp3", L("Ding 2")}, 
  {"Interface\\AddOns\\EasyOptions\\Sounds\\Ding 3.mp3", L("Ding 3")}, 
  {"Interface\\AddOns\\EasyOptions\\Sounds\\Ding 4.mp3", L("Ding 4")}, 
  {"Interface\\AddOns\\EasyOptions\\Sounds\\Moo.mp3", L("Moo")}, 
  {"Interface\\AddOns\\EasyOptions\\Sounds\\Quack.mp3", L("Quack")}, 
  {"Interface\\AddOns\\EasyOptions\\Sounds\\Gentle Alarm.mp3", L("Gentle Alarm")}, 
  {"567439", L("Quest Completed")}, -- 619
  {"569593", L("Level Up")}, -- 888
  {"567451", L("Player Invite Accept")}, -- 881
  {"567478", L("Ready Check")}, -- 8960
  {"567465", L("LFG Dungeon Ready")}, -- 17318
  {"567397", L("Raid Warning")}, -- 8959
  {"569200", L("Flag Taken Alliance")}, -- 567466
  {"568165", L("Flag Taken Horde")}, -- 9379 -- 567427
  {"567482", L("Auction Window Open")}, -- 5274
  {"567499", L("Auction Window Close")}, -- 5275
  {"567419", L("Character Selection Enter World")}, -- 809
  {"4565246", L("Spell FX")}, -- 230103, FILEDATA_4565246
  {"568013", L("Firework")}, -- 89878
  {"569423", L("Stealth")}, -- 3325
  {"548880", L("Fel Reaver Alarm")}, -- 10571
  {"3548269", L("Castle Nathria Mirror Room")}, -- 172361
  {"542372", L("Human Male Player Death")}, -- 2944
  {"540267", L("Gnome Male Emote Laugh")}, -- 6913
  {"542887", L("Tauren Male Cry")}, -- 6951
  {"556000", L("Murloc Aggro")}, -- 416
  {"1466150", L("Succubus Entice")}, -- 7096
  {"551703", L("Horseman Laugh")}, -- 11965
}

EasyOptions.Fields.DefaultFontFileInfos = { -- Frizqt__, ARIALN, MORPHEUS, skurri
  {"Fonts\\Frizqt__.TTF", L("Friz Quadrata")}, 
  {"Fonts\\ARIALN.TTF", L("Arial Narrow")}, 
  {"Fonts\\MORPHEUS.TTF", L("Morpheus")}, 
  {"Fonts\\skurri.TTF", L("Skurri")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Aladin.ttf", L("Aladin")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Bazooka.ttf", L("Bazooka")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Chewy.ttf", L("Chewy")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Coffee Jelly.ttf", L("Coffee Jelly")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\First Coffee.otf", L("First Coffee")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Fredoka One.otf", L("Fredoka One")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Junegull.otf", L("Junegull")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Kingthings Hand.ttf", L("Kingthings Hand")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Latin Modern Mono.otf", L("Latin Modern Mono")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Minya Nouvelle.otf", L("Minya Nouvelle")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Motley Forces.otf", L("Motley Forces")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Mouse Memoirs.ttf", L("Mouse Memoirs")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Newt Serif.otf", L("Newt Serif")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Open Dyslexic.otf", L("Open Dyslexic")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Pajama Pants.ttf", L("Pajama Pants")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Party Confetti.otf", L("Party Confetti")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Puffy.otf", L("Puffy")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Ranchers.ttf", L("Ranchers")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Riffic.ttf", L("Riffic")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Smokum.ttf", L("Smokum")}, 
  {"Interface\\AddOns\\EasyOptions\\Fonts\\Super Computer.ttf", L("Super Computer")}, 
}
EasyOptions.Fields.DefaultFontFilePath = "Fonts\\Frizqt__.TTF" -- Frizqt__, ARIALN, MORPHEUS, skurri
EasyOptions.Fields.DefaultGroupLabelFontObjectName = "GameFontNormalMed1" -- GameFontNormal, GameFontNormalMed1, GameFontNormalMed2, GameFontNormalSmall, GameFontHighlightSmall. See also "https://wowpedia.fandom.com/wiki/API_FontInstance_SetFontObject".
EasyOptions.Fields.DefaultLabelFontObjectName = "GameFontHighlight" -- GameFontNormal, GameFontNormalMed1, GameFontNormalMed2, GameFontNormalSmall, GameFontHighlightSmall. See also "https://wowpedia.fandom.com/wiki/API_FontInstance_SetFontObject".
EasyOptions.Fields.DefaultFontSize = 12
EasyOptions.Fields.DefaultTitleFontSize = 13
EasyOptions.Fields.FontSizeMaxAllowed = 128 -- The max font size seems to be limited to 128 by the WoW API. This limit also applies to the parent frame's scale factor such that (font size) * (parent frame's scale factor) cannot exceed 128.
EasyOptions.Fields.DefaultFontFlags = "" -- Any comma-delimited combination of "OUTLINE", "THICKOUTLINE", and "MONOCHROME" (e.g., "OUTLINE, THICKOUTLINE, MONOCHROME").
EasyOptions.Fields.DefaultFontInfo = {EasyOptions.Fields.DefaultFontFilePath, EasyOptions.Fields.DefaultFontSize, EasyOptions.Fields.DefaultFontFlags}
EasyOptions.Fields.DefaultFontColor = EasyOptions.Fields.DefaultTextColor
-- EasyOptions.Fields.FontInfoProvider = nil -- Represents a FontString that is created JIT and is used to get information about standard fonts (e.g., "GameFontNormal").

EasyOptions.Fields.TextureInfos = {}
EasyOptions.Fields.TextureInfos.ControlStyleDropDownItemInfos = {
  {"Classic", L("Classic")}, 
  {"Modern", L("Modern")}, 
}
EasyOptions.Fields.TextureInfos.DefaultControlStyle = "Classic"
EasyOptions.Fields.TextureInfos.Classic = {
  BorderBackdropInset = 3, -- Specifies how much each side of a frame is indented from the corresponding border edge.
  DefaultBackgroundFilePath = "Interface\\Tooltips\\UI-Tooltip-Background", -- "Interface\\Buttons\\WHITE8x8"
  DefaultBorderFilePath = "Interface\\Tooltips\\UI-Tooltip-Border", 
  TabButtonBackgroundHighlightTopFilePath = "Interface\\AddOns\\EasyOptions\\Textures\\GradientVerticalTop.tga", 
  TabButtonBackgroundHighlightBottomFilePath = "Interface\\AddOns\\EasyOptions\\Textures\\GradientVerticalBottom.tga", 
  TabButtonBorderNormalTopFilePath = "Interface\\AddOns\\EasyOptions\\Textures\\BorderTexturesClassicDarkTop.png", 
  TabButtonBorderNormalBottomFilePath = "Interface\\AddOns\\EasyOptions\\Textures\\BorderTexturesClassicDarkBottom.png", 
  TabButtonBorderHighlightTopFilePath = "Interface\\AddOns\\EasyOptions\\Textures\\BorderTexturesClassicLightTop.png", 
  TabButtonBorderHighlightBottomFilePath = "Interface\\AddOns\\EasyOptions\\Textures\\BorderTexturesClassicLightBottom.png", 
  ListViewItemBackgroundHighlightFilePath = "Interface\\AddOns\\EasyOptions\\Textures\\GradientHorizontalWithBorders.tga", 
}
EasyOptions.Fields.TextureInfos.Modern = {
  BorderBackdropInset = 2, -- Specifies how much each side of a frame is indented from the corresponding border edge.
  DefaultBackgroundFilePath = "Interface\\Tooltips\\UI-Tooltip-Background", -- "Interface\\Buttons\\WHITE8x8"
  DefaultBorderFilePath = "Interface\\AddOns\\EasyOptions\\Textures\\BorderTexturesModernDarkFull.png", 
  TabButtonBackgroundHighlightTopFilePath = "Interface\\AddOns\\EasyOptions\\Textures\\SolidColorAlpha255.tga", 
  TabButtonBackgroundHighlightBottomFilePath = "Interface\\AddOns\\EasyOptions\\Textures\\SolidColorAlpha255.tga", 
  TabButtonBorderNormalTopFilePath = "Interface\\AddOns\\EasyOptions\\Textures\\BorderTexturesModernDarkTop.png", 
  TabButtonBorderNormalBottomFilePath = "Interface\\AddOns\\EasyOptions\\Textures\\BorderTexturesModernDarkBottom.png", 
  TabButtonBorderHighlightTopFilePath = "Interface\\AddOns\\EasyOptions\\Textures\\BorderTexturesModernLightTop.png", 
  TabButtonBorderHighlightBottomFilePath = "Interface\\AddOns\\EasyOptions\\Textures\\BorderTexturesModernLightBottom.png", 
  ListViewItemBackgroundHighlightFilePath = "Interface\\AddOns\\EasyOptions\\Textures\\SolidColorAlpha128.tga", 
}

EasyOptions.Fields.DefaultBarDelimiterInfo = EasyOptions:CreateBarDelimiterInfo()
EasyOptions.Fields.DefaultCommaDelimiterInfo = EasyOptions:CreateCommaDelimiterInfo()
EasyOptions.Fields.DefaultLinesDelimiterInfo = EasyOptions:CreateLinesDelimiterInfo()
EasyOptions.Fields.DefaultDelimiterInfo = EasyOptions:CreateDefaultDelimiterInfo()

EasyOptions.Fields.EmptyDropDownValue = "" -- NOTE: Some code, messages, or comments might assume that this field equals an empty string. Specifies the value that is used to indicate that no value is selected in a DropDown. This field was implemented so a distinction can be made between an option value that was never set (i.e., nil) and an option value that corresponds to no item being selected in a DropDown because the user deleted all of the DropDown's items. Otherwise, if we set an option value to nil then that option value will be restored to its default value in EasyOptions:InitializeOptionValue which will cause the option value to change after a Reload UI.

EasyOptions.Fields.DefaultSoundChannel = "SFX"

EasyOptions.Fields.PrintedMessages = {} -- This is used and updated by the EasyOptions:PrintMessageOnce method.

EasyOptions.Fields.AreOptionValuesChanging = {} -- [AddonName] = true/false. Indicates whether multiple option values are being changed for the corresponding addon.
EasyOptions.Fields.IsResettingOptionValues = {} -- [AddonName] = [1] IsResetting, [2] OptionItems. Indicates whether option values are being reset for the corresponding addon.

EasyOptions.Fields.NilValueIndicator = "[nil]"

EasyOptions.Fields.TooltipOwner = nil -- IMPORTANT: This was implemented because GameTooltip clears its owner when GameTooltip:Hide() is called, but some logic in this addon requires us to know whether a control should be considered to be the owner of GameTooltip even if GameTooltip is not shown.
EasyOptions.Fields.EnableRefreshTooltipAfterControlValueChanged = true -- Indicates whether to allow a control's tooltip to be updated after the control's value has changed.

EasyOptions.Fields.AddonVersionOptionName = "EasyOptions_AddonVersion"
