local _, private = ...

function private.AddOns.Masque()
    local MSQ = _G.LibStub("Masque")
    local Hidden = MSQ.__Hidden
    local GetAddOnMetadata = (_G.C_AddOns and _G.C_AddOns.GetAddOnMetadata) or _G.GetAddOnMetadata
    local RealUI = private.RealUI or _G.RealUI
    local skinVersion

    if RealUI and RealUI.verinfo and RealUI.verinfo.string then
        skinVersion = RealUI.verinfo.string
    end

    if (not skinVersion or skinVersion == "") and GetAddOnMetadata then
        skinVersion = GetAddOnMetadata("RealUI_Skins", "Version")
    end

    if not skinVersion or skinVersion == "" then
        skinVersion = "0.0.0"
    end

    MSQ:AddSkin("RealUI", {
        Template = "Blizzard Modern",
        Shape = "Square",
        API_VERSION = 110210,

        Author = "Gethe/Arnvid",
        Version = skinVersion,

        Backdrop = {
            Texture = [[Interface\AddOns\Masque\Textures\Backdrop\Action]],
            TexCoords = {0.08, 0.92, 0.08, 0.92},
            BlendMode = "BLEND",
            DrawLayer = "BACKGROUND",
            Width = 26,
            Height = 26,
            Item = {
                Texture = [[Interface\AddOns\Masque\Textures\Backdrop\Item]],
                -- TexCoords = {0, 1, 0, 1},
                -- Color = {1, 1, 1, 1},
                BlendMode = "BLEND",
                DrawLayer = "BACKGROUND",
                DrawLevel = -1,
            },
            Pet = {
                Texture = [[Interface\AddOns\Masque\Textures\Backdrop\Pet]],
                -- TexCoords = {0, 1, 0, 1},
                -- Color = {1, 1, 1, 1},
                BlendMode = "BLEND",
                DrawLayer = "BACKGROUND",
                DrawLevel = -1,
            },
        },
        Icon = {
            Texture = [[Interface\Icons\INV_Misc_Bag_08]],
            TexCoords = {0.08, 0.92, 0.08, 0.92},
            BlendMode = "BLEND",
            Width = 26,
            Height = 26,
        },
        -- SlotIcon = Template.Hidden,
        -- Shadow = Template.Hidden,
        Normal = {
            Texture = [[Interface\AddOns\RealUI_Skins\Media\Border]],
            BlendMode = "BLEND",
            DrawLayer = "ARTWORK",
            Color = {0, 0, 0, 1},
            Width = 32,
            Height = 32,
        },
        -- Disabled = Template.Hidden,
        Pushed = {
            Texture = [[Interface\Buttons\UI-Quickslot-Depress]],
            TexCoords = {0.08, 0.92, 0.08, 0.92},
            BlendMode = "BLEND",
            -- DrawLayer = "BORDER",
            Width = 26,
            Height = 26,
        },
        Flash = {
            Color = {1, 0, 0, 0.3},
            BlendMode = "ADD",
            DrawLayer = "BORDER",
            Width = 32,
            Height = 32,
            UseColor = true
        },
        HotKey = {
            JustifyH = "LEFT",
            Width = 26,
            Height = 8,
            Anchor = "Icon",
            DrawLayer = "OVERLAY",
            Point = "TOPLEFT",
            RelPoint = "TOPLEFT",
            OffsetX = 11,
            OffsetY = -13,
        },
        Count = {
            JustifyH = "RIGHT",
            DrawLayer = "OVERLAY",
            Anchor = "Icon",
            Width = 26,
            Height = 6,
            OffsetX = -8,
            OffsetY = 12,
        },
        Duration = {
            DrawLayer = "OVERLAY",
            Anchor = "Icon",
            Width = 26,
            Height = 10,
            OffsetY = -2,
        },
        Checked = {
            Texture = [[Interface\Buttons\CheckButtonHilight]],
            TexCoords = {0.08, 0.92, 0.08, 0.92},
            Color = {0, 0, 0, 0.5},
            BlendMode = "BLEND",
            DrawLayer = "OVERLAY",
            Width = 26,
            Height = 26,
        },
        SlotHighlight = "Checked",
        Name = {
            JustifyH = "LEFT",
            DrawLayer = "OVERLAY",
            Anchor = "Icon",
            Width = 26,
            Height = 10,
            OffsetX = 1,
            OffsetY = 5,
        },
        Border = {
            Texture = [[Interface\AddOns\RealUI_Skins\Media\Border]],
            BlendMode = "BLEND",
            DrawLayer = "OVERLAY",
            DrawLevel = 0,
            Width = 32,
            Height = 32,
        },
        IconBorder = "Border",
        -- Gloss = Template.Hidden,
        NewAction = {
            Atlas = "bags-newitem",
            BlendMode = "BLEND",
            DrawLayer = "OVERLAY",
            TexCoords = {0.15, 0.85, 0.15, 0.85},
            Width = 26,
            Height = 26,
        },
        SpellHighlight = "NewAction",
        AutoCastable = {
            Texture = [[Interface\Buttons\UI-AutoCastableOverlay]],
            TexCoords = {0.21875, 0.765625, 0.21875, 0.765625},
            BlendMode = "BLEND",
            DrawLayer = "OVERLAY",
            DrawLevel = 1,
            Width = 26,
            Height = 26,
        },
        IconOverlay = Hidden,
        --UpgradeIcon = Template,
        --IconOverlay2 = Template,
        --QuestBorder = Template,
        NewItem = {
            Atlas = "bags-glow-white",
            TexCoords = {0.08, 0.92, 0.08, 0.92},
            BlendMode = "ADD",
            DrawLayer = "OVERLAY",
            DrawLevel = 2,
            Width = 26,
            Height = 26,
        },
        SearchOverlay = {
            Width = 26,
            Height = 26,
        },
        ContextOverlay = "SearchOverlay",
        --JunkIcon = Template,
        Highlight = {
            Texture = [[Interface\Buttons\ButtonHilight-Square]],
            TexCoords = {0.08, 0.92, 0.08, 0.92},
            BlendMode = "ADD",
            DrawLayer = "HIGHLIGHT",
            DrawLevel = 0,
            Width = 26,
            Height = 26,
        },
        AutoCastShine = {
            Atlas = "UI-HUD-ActionBar-PetAutoCast-Ants",
            UseAtlasSize = false,
            BlendMode = "BLEND",
            DrawLayer = "OVERLAY",
            DrawLevel = 0,
            Width = 26,
            Height = 26,
            OffsetX = 1,
            OffsetY = -1,
        },
        AutoCast_Corners = {
            Atlas = "UI-HUD-ActionBar-PetAutoCast-Corners",
            UseAtlasSize = false,
            DrawLayer = "OVERLAY",
            DrawLevel = 1,
            Width = 26,
            Height = 26,
            OffsetX = 1,
            OffsetY = -1,
        },
        Cooldown = {
            Width = 26,
            Height = 26,
        },
        CooldownLoC = "Cooldown",
        ChargeCooldown = {
            Width = 26,
            Height = 26,
            Anchor = "Icon",
        },
        AssistedCombatHighlight = {
            Width = 38,
            Height = 38,
        },
    }, true)
end
