options = {
    name = "Killing Blow Announcer",
    handler = KillingBlowAnnouncer,
    type = 'group',
    childGroups = "tab",
    args = {
        pvp = {
            type = "toggle",
            name = "Enable PVP only",
            desc = "Enables the addon to only work for player kills. If left unchecked it will announce and track every kill regardless if it's a player or not.",
            order = 1,
            get = "EnablePVP",
            set = "ToggleEnablePVP",
        },
        minimap = {
            type = "toggle",
            name = "Enable minimap icon",
            desc = "Enables the minimap icon.",
            order = 1,
            get = "GetEnableMinimapIcon",
            set = "ToggleEnableMinimapIcon",
        },
        startup = {
            type = "toggle",
            name = "Hide startup message",
            desc = "Disables the startup message that occurs when the addon has been loaded.",
            order = 1,
            get = "GetDisableStartupText",
            set = "ToggleGetEnableStartupText",
        },
        chat = {
            name = "Chat",
            desc = "Options related to messages that can be send to the chat.",
            type = "group",
            order = 1,
            childGroups = "tab",
            args = {
                simple_enable = {
                    type = "toggle",
                    name = "Enable simple",
                    desc = "Displays a simple message that will be displayed in your specified chat window channel.",
                    order = 1,
                    get = "EnableMSG",
                    set = "ToggleEnableMSG",
                },
                advanced_enable = {
                    type = "toggle",
                    name = "Enable advanced",
                    desc = "Displays an advanced message variant of the simple message in the specified chat window channel.",
                    order = 2,
                    get = "EnableMSGAnnounce",
                    set = "ToggleEnableMSGAnnounce",
                },
                simple_group = {
                    name = "Simple",
                    desc = "Options related to showing a simple chat message.",
                    type = "group",
                    order = 3,
                    args = {
                        simple_channel = {
                            name = "Channel",
                            desc = "Adjust in which channel the message should be displayed.",
                            order = 4,
                            type = "select",
                            width = "full",
                            values = chatChannelsTable,
                            get = function(info) return KillingBlowAnnouncer:GetChatChannel(info) end,
                            set = function(info, key) KillingBlowAnnouncer:SetChatChannel(info, key) end,
                        },
                        simple_message = {
                            type = "input",
                            name = "Message",
                            desc = "The chat message displayed when you get a killing blow.",
                            order = 3,
                            width = "full",
                            usage = "To edit message, fill in the input field and press the okay button.",
                            get = "GetMessage",
                            set = "SetMessage",
                        },
                    },
                },
                advanced_group = {
                    name = "Advanced",
                    desc = "Options related to showing an advanced chat message.",
                    type = "group",
                    order = 4,
                    args = {
                        advanced_desc = {
                            type = "description",
                            name = "When changing the messages make sure to write the ${} variables exactly as written within the possible variables else it won't display the value. If you only want to display something like 'I killed Eucalyptisch in Shadowmoon valley' simply remove the unneeded ${} and it will work. For example the default player kills message for the previous sentence would be 'I killed ${enemy} in ${zone}'. \n",
                            fontSize = "medium",
                            order = 0,
                            width = "full",
                        },
                        advanced_message = {
                            type = "input",
                            name = "Advanced message player kills",
                            desc = "The advanced message displayed when you get a killing blow. This message will be played if the killing blow is on a player enemy.",
                            order = 2,
                            width = "full",
                            usage = "To edit message, fill in the input field and press the okay button.",
                            get = "GetAnnounceMessage",
                            set = "SetAnnounceMessage",
                        },
                        advanced_desc_player = {
                            type = "description",
                            name = "Possible variables:\n|cff3498db${player} = your player name.\n${playerlevel} = your current level.\n${playerclass} = your class.\n${playerrace} = your race.\n${playergender} = your gender.\n${playerrealm} = your realm.\n${zone} = the zone that the player was killed in.\n${enemy} = the killed player's name.\n${class} = the killed player's class.\n${gender} = the killed player's gender.\n${race} = the killed player's race.\n${realm} = the killed player's realm.",
                            fontSize = "medium",
                            order = 3,
                            width = "full",
                        },
                        advanced_message_non = {
                            type = "input",
                            name = "Advanced message non-player kills",
                            desc = "The advanced message displayed when you get a killing blow. This message will be played if the killing blow is on a non-player enemy.",
                            order = 4,
                            width = "full",
                            usage = "To edit message, fill in the input field and press the okay button.",
                            get = "GetAnnounceMessageNon",
                            set = "SetAnnounceMessageNon",
                        },
                        advanced_desc_non = {
                            type = "description",
                            name = "Possible variables:\n|cff3498db${player} = your player name.\n${playerlevel} = your current level.\n${playerclass} = your class.\n${playerrace} = your race.\n${playergender} = your gender.\n${playerrealm} = your realm.\n${zone} = the zone that the enemy was killed in.\n${enemy} = the killed enemy's name.",
                            fontSize = "medium",
                            order = 5,
                            width = "full",
                        },
                        advanced_channel = {
                            name = "Channel",
                            desc = "Adjust in which channel the message should be displayed.",
                            order = 1,
                            width = "full",
                            type = "select",
                            values = chatChannelsTable,
                            get = function(info) return KillingBlowAnnouncer:GetChatAnnounceChannel(info) end,
                            set = function(info, key) KillingBlowAnnouncer:SetChatAnnounceChannel(info, key) end,
                        },
                    },
                },
            },
        },
        tracker = {
            name = "Tracker",
            desc = "Options related to a tracker which tracks killing blows in the current zone/session.",
            type = "group",
            order = 5,
            args = {
                tracker_enable = {
                    type = "toggle",
                    name = "Enable tracker",
                    order = 1,
                    desc = "Enables the Killing blow tracker frame.",
                    get = "EnableKBT",
                    set = "ToggleEnableKBT",
                },
                tracker_lock = {
                    type = "toggle",
                    name = "Enable dragging",
                    order = 2,
                    desc = "Enables the user to drag the frame around.",
                    get = "EnableKBTDrag",
                    set = "ToggleEnableKBTDrag",
                },
                tracker_background = {
                    name = "Background file",
                    desc = "Adjust background file of the tracker.",
                    order = 6,
                    width = "double",
                    type = "select",
                    values = Media:HashTable("background"),
                    dialogControl = "LSM30_Background",
                    get = function(info) return KillingBlowAnnouncer:GetTrackerBackground(info) end,
                    set = function(info, key) KillingBlowAnnouncer:SetTrackerBackground(info, key) end,
                },
                tracker_border = {
                    name = "Border file",
                    desc = "Adjust border file of the tracker.",
                    order = 6,
                    width = "double",
                    type = "select",
                    values = Media:HashTable("border"),
                    dialogControl = "LSM30_Border",
                    get = function(info) return KillingBlowAnnouncer:GetTrackerBorder(info) end,
                    set = function(info, key) KillingBlowAnnouncer:SetTrackerBorder(info, key) end,
                },
                tracker_font = {
                    name = "Font",
                    desc = "Adjust the font settings.",
                    order = 6,
                    width = "double",
                    type = "select",
                    values = Media:HashTable("font"),
                    dialogControl = "LSM30_Font",
                    get = function(info) return KillingBlowAnnouncer:GetTrackerFont(info) end,
                    set = function(info, key) KillingBlowAnnouncer:SetTrackerFont(info, key) end,
                },
            },
        },
        announcer = {
            name = "Announcer",
            desc = "Options related to displaying customisable messages in the middle of the screen.",
            type = "group",
            childGroups = 'tab',
            order = 2,
            args = {
                announcer_message = {
                    name = "Message",
                    desc = "Options related to showing a text message.",
                    type = "group",
                    order = 3,
                    args = {
                        message_edit = {
                            type = "toggle",
                            name = "Snap message frame",
                            desc = "Snaps the killing blow message to the window for editing purposes. Disable this option when done editing.",
                            get = "EnableSnap",
                            order = 1,
                            set = "ToggleEnableSnap",
                        },
                        message_lock = {
                            type = "toggle",
                            name = "Enable dragging",
                            order = 2,
                            desc = "Enables the user to drag the message frame around.",
                            get = "EnableMessageDrag",
                            set = "ToggleEnableMessageDrag",
                        },
                        message_message = {
                            type = "input",
                            name = "Killing blow message",
                            order = 3,
                            width = "full",
                            desc = "The message that gets displayed when you make a killing blow",
                            usage = "<Your message here>",
                            get = "GetKillingMessage",
                            set = "SetKillingMessage",
                        },
                        message_height = {
                            type = "range",
                            name = "Height",
                            min = 40,
                            max = 500,
                            width = "full",
                            desc = "Adjust the message height. Min/max is limited because the message can disappear when using weird numbers.",
                            order = 7,
                            get = "GetKBMHeight",
                            set = "SetKBMHeight",
                        },
                        message_width = {
                            type = "range",
                            name = "Width",
                            min = 40,
                            max = 500,
                            width = "full",
                            desc = "Adjust the message width. Min/max is limited because the message can disappear when using weird numbers.",
                            order = 7,
                            get = "GetKBMWidth",
                            set = "SetKBMWidth",
                        },
                        message_font = {
                            name = "Font",
                            desc = "Adjust the font settings.",
                            order = 6,
                            width = "full",
                            type = "select",
                            values = Media:HashTable("font"),
                            dialogControl = "LSM30_Font",
                            get = function(info) return KillingBlowAnnouncer:GetFont(info) end,
                            set = function(info, key) KillingBlowAnnouncer:SetFont(info, key) end,
                        },
                        message_font_outline = {
                            name = "Font Outline",
                            desc = "Adjust the font outline.",
                            order = 5,
                            width = "full",
                            type = "select",
                            get = function(info) return KillingBlowAnnouncer:GetOutline(info) end,
                            set = function(info, key) KillingBlowAnnouncer:SetOutline(info, key) end,
                            values = {
                                NONE = "None",
                                OUTLINE = "Thin",
                                THICKOUTLINE = "Thick",
                            },
                        },
                        message_color = {
                            name = "Color",
                            desc = "Adjust the color of the message.",
                            order = 4,
                            width = "full",
                            type = "color",
                            hasAlpha = false,
                            get = function(info) return KillingBlowAnnouncer:GetRed(info), KillingBlowAnnouncer:GetGreen(info), KillingBlowAnnouncer:GetBlue(info) end,
                            set = function(info, r, g, b) KillingBlowAnnouncer:SetRed(info, r) KillingBlowAnnouncer:SetGreen(info, g) KillingBlowAnnouncer:SetBlue(info, b) setColors() end,
                        },
                        message_font_size = {
                            type = "range",
                            name = "FontSize",
                            min = 0,
                            max = 29,
                            width = "full",
                            desc = "Adjust the font size. Default is 29 (as of unknown reasons text disappears above fontsize 29).",
                            order = 8,
                            get = "GetFontSize",
                            set = "SetFontSize",
                        },
                        message_visible_time = {
                            type = "range",
                            name = "VisibleTime",
                            min = 0,
                            max = 60,
                            width = "full",
                            desc = "Adjust the time that the message is visible in seconds. Default is 3.",
                            order = 8,
                            get = "GetVisibleTime",
                            set = "SetVisibleTime",
                        },
                        message_fade_time = {
                            type = "range",
                            name = "FadeTime",
                            min = 0,
                            max = 20,
                            width = "full",
                            desc = "Adjust the time that it takes for the message to fade from start to end in seconds. Default is 1.",
                            order = 9,
                            get = "GetFadeTime",
                            set = "SetFadeTime",
                        },
                    },
                },
                announcer_image = {
                    name = "Image",
                    desc = "Options related to showing an image.",
                    type = "group",
                    order = 4,
                    args = {
                        image_enable = {
                            type = "toggle",
                            name = "Start image loop",
                            desc = "Loops the image to the window for editing purposes. Disable this option when done editing.",
                            get = "GetKBIDebug",
                            order = 1,
                            set = "ToggleKBIDebug",
                        },
                        image_lock = {
                            type = "toggle",
                            name = "Enable dragging",
                            order = 2,
                            desc = "Enables the user to drag the image frame around.",
                            get = "EnableImageDrag",
                            set = "ToggleEnableImageDrag",
                        },
                        image_image = {
                            name = "Image file",
                            desc = "Pick which image you want announced. See the addon description on curse for a guide on how to add custom images.",
                            order = 3,
                            width = "full",
                            type = "select",
                            values = Media:HashTable("images"),
                            dialogControl = "LSM30_Background",
                            get = function(info) return KillingBlowAnnouncer:GetKBIImage(info) end,
                            set = function(info, key) KillingBlowAnnouncer:SetKBIImage(info, key) end,
                        },
                        image_height = {
                            type = "range",
                            name = "Height",
                            min = 0,
                            max = 1000,
                            width = "full",
                            desc = "Adjust the image height.",
                            order = 5,
                            get = "GetKBIHeight",
                            set = "SetKBIHeight",
                        },
                        image_width = {
                            type = "range",
                            name = "Width",
                            min = 0,
                            max = 1000,
                            width = "full",
                            desc = "Adjust the image width.",
                            order = 5,
                            get = "GetKBIWidth",
                            set = "SetKBIWidth",
                        },
                        image_fade_in = {
                            type = "range",
                            name = "FadeIn time",
                            min = 0,
                            max = 2,
                            width = "full",
                            desc = "Adjust the time it takes for the image to fade in. Default is 0,5.",
                            order = 7,
                            get = "GetFadeInTime",
                            set = "SetFadeInTime",
                        },
                        image_fade_out = {
                            type = "range",
                            name = "FadeOut time",
                            min = 0,
                            max = 2,
                            width = "full",
                            desc = "Adjust the time it takes for the image to fade out. Default is 0,5.",
                            order = 8,
                            get = "GetFadeOutTime",
                            set = "SetFadeOutTime",
                        },
                        image_duration = {
                            type = "range",
                            name = "Image duration",
                            min = 0,
                            max = 10,
                            width = "full",
                            desc = "Adjust the time that the image is displayed after fadeIn ends. Default is 1.",
                            order = 9,
                            get = "GetEndDelay",
                            set = "SetEndDelay",
                        },
                    },
                },
                announcer_enable = {
                    type = "toggle",
                    name = "Enable announcer",
                    order = 1,
                    desc = "Enables the announcing using message or image.",
                    width = "full",
                    get = "EnableKB",
                    set = "ToggleEnableKB",
                },
                announcer_modus = {
                    name = "Mode",
                    desc = "Enable either message mode or image mode. Message mode will display a message in the middle of the screen. Image mode will display an image in the middle of the screen",
                    order = 6,
                    type = "select",
                    values = { "Message mode", 'Image mode' },
                    style = "radio",
                    get = function(info) return KillingBlowAnnouncer:GetModus(info) end,
                    set = function(info, key) KillingBlowAnnouncer:SetModus(info, key) end,
                },
            },
        },
        sound = {
            name = "Sound",
            desc = "Options related to playing a sound file.",
            type = "group",
            order = 3,
            childGroups = 'tab',
            args = {
                sound_random = {
                    name = "Random",
                    desc = "Options related randomly playing a soundfile.",
                    type = "group",
                    order = 4,
                    args = {
                        random_uncheck = {
                            type = "execute",
                            name = "Uncheck all files",
                            order = 2,
                            func = function(info) KillingBlowAnnouncer:UncheckAllSounds() end,
                        },
                        ramdom_sounds = {
                            name = "Soundfiles",
                            desc = "Pick the sounds from which one will randmly be played on a killing blow.",
                            order = 4,
                            width = "full",
                            type = "multiselect",
                            values = Media:HashTable("sound"),
                            get = function(info, key) return KillingBlowAnnouncer:ExistsInSounds(info, key) end,
                            set = function(info, key) KillingBlowAnnouncer:SetSound(info, key) end,
                        },
                    }
                },
                sound_ordered = {
                    name = "Ordered",
                    desc = "Options related playing a soundfile in a order.",
                    type = "group",
                    order = 4,
                    args = {
                        ordered_enable_end = {
                            type = "toggle",
                            name = "Restart after end",
                            order = 2,
                            desc = "If the list should restart from the beginning once the last soundfile has been played.",
                            get = "EnableSoundOrderedRestartEnd",
                            set = "ToggleEnableSoundOrderedRestartEnd",
                        },
                        ordered_enable_death = {
                            type = "toggle",
                            name = "Restart after death",
                            order = 2,
                            desc = "If the list should restart from the beginning once you have died.",
                            get = "EnableSoundOrderedRestartDeath",
                            set = "ToggleEnableSoundOrderedRestartDeath",
                        },
                        ordered_enable_zone = {
                            type = "toggle",
                            name = "Restart after zone change",
                            order = 2,
                            desc = "If the list should restart from the beginning once you have changed zones.",
                            get = "EnableSoundOrderedRestartZone",
                            set = "ToggleEnableSoundOrderedRestartZone",
                        },
                        ordered_enable_time = {
                            type = "toggle",
                            name = "Restart after certain time",
                            order = 3,
                            desc = "If the list should restart from the beginning after a certain amount of time passes after a killing blow.",
                            get = "EnableSoundOrderedRestartTime",
                            set = "ToggleEnableSoundOrderedRestartTime",
                        },
                        advanced_desc = {
                            type = "description",
                            name = "With the options below you can create a list of sounds that are ordered by number. The number represents on which killing blow the sound will be played.\n\nBy enabling restart options the list will restart from the beginning after one of the conditions has been fulfilled. Logging out or reloading the ui will always restart the list from the beginning.\n\n",
                            fontSize = "medium",
                            order = 1,
                            width = "full",
                        },
                        ordered_new = {
                            type = "execute",
                            name = "Add sound",
                            order = 6,
                            func = function(info)
                                local options = options.args.sound.args.sound_ordered.args
                                local index = tostring(KillingBlowAnnouncer:GetSoundOrderedIndex())
                                local label = index .. "."

                                options[index] = {
                                    name = label,
                                    order = index + 6,
                                    width = "full",
                                    type = "select",
                                    dialogControl = 'LSM30_Sound',
                                    values = Media:HashTable("sound"),
                                    get = function(info) return KillingBlowAnnouncer:GetSoundOrderedListItem(info) end,
                                    set = function(info, key) KillingBlowAnnouncer:SetSoundOrderedListItem(info, key) end,
                                }

                                KillingBlowAnnouncer:IncrementOrderedIndex()
                            end,
                        },
                        ordered_header = {
                            type = "header",
                            order = 5,
                            name = "Sounds list",
                        },
                        ordered_remove = {
                            type = "execute",
                            name = "Remove last sound",
                            order = 6,
                            func = function(info)
                                local options = options.args.sound.args.sound_ordered.args
                                local index = tostring(KillingBlowAnnouncer:GetSoundOrderedIndex() - 1)

                                options[index] = nil

                                KillingBlowAnnouncer:SetSoundOrderedListItem(info, value, index)
                                KillingBlowAnnouncer:DecrementOrderedIndex()
                            end,
                        },
                    },
                },

                -- after time
                -- zone change
                sound_modus = {
                    name = "Mode",
                    desc = "Enable either random mode or ordered mode. Random mode will randomly play sounds from a list. Ordered mode will play sounds in order based on a definable list.",
                    order = 3,
                    type = "select",
                    values = { 'Ordered mode', 'Random mode' },
                    style = "radio",
                    get = function(info) return KillingBlowAnnouncer:GetSoundModus(info) end,
                    set = function(info, key) KillingBlowAnnouncer:SetSoundModus(info, key) end,
                },
                sound_enable = {
                    type = "toggle",
                    name = "Enable soundfiles",
                    order = 1,
                    desc = "Enables playing of the soundfiles.",
                    get = "EnableKBSound",
                    set = "ToggleEnableKBSound",
                },
                sound_channel = {
                    name = "Sound channel",
                    desc = "Adjust on which sound channel the sound gets played.",
                    order = 2,
                    width = "full",
                    type = "select",
                    values = soundChannelsTable,
                    get = function(info) return KillingBlowAnnouncer:GetSoundLevel(info) end,
                    set = function(info, key) KillingBlowAnnouncer:SetSoundLevel(info, key) end,
                },
            },
        },
        emotes = {
            name = "Emotes",
            desc = "Options related to playing emotes.",
            type = "group",
            order = 4,
            args = {
                emotes_enable = {
                    type = "toggle",
                    name = "Enable emotes",
                    order = 1,
                    desc = "Enables playing of an random emote after a killing blow.",
                    get = "EnableEmotes",
                    set = "ToggleEnableEmotes",
                },
                emotes_uncheck = {
                    type = "execute",
                    name = "Uncheck all emotes",
                    order = 2,
                    func = function(info) KillingBlowAnnouncer:UncheckAllEmotes() end,
                },
                emotes_emotes = {
                    name = "Emotes",
                    desc = "Pick the emotes from which one will randomly be played on a killing blow.",
                    order = 3,
                    type = "multiselect",
                    values = emotesTable,
                    get = function(info, key) return KillingBlowAnnouncer:ExistsInEmotes(info, key) end,
                    set = function(info, key) KillingBlowAnnouncer:SetEmote(info, key) end,
                },
            },
        },
    },
}