local scughelper = require("mods").requireFromPlugin("libraries.scughelper")
local drawableFunc = require("structs.drawable_function")
local drawing = require("utils.drawing")
return {
    name = "ScugHelper/RefillCircle",
    depth = 5000,
    placements = {
        {
            name = "green",
            data = { FallbackRefillOneUse = false, FallbackRefillType = "green", width = 32, height = 32, OutlineColor = "93bd40", InfillColor = "208020", InfillOpacity = 0.3 }
        },
        {
            name = "pink",
            data = { FallbackRefillOneUse = false, FallbackRefillType = "pink", width = 32, height = 32, OutlineColor = "fb94ff", InfillColor = "e268d1", InfillOpacity = 0.3 }
        },
        {
            name = "blue",
            data = { FallbackRefillOneUse = false, FallbackRefillType = "blue", width = 32, height = 32, OutlineColor = "5ed0f6", InfillColor = "30639d", InfillOpacity = 0.3 }
        },
        {
            name = "black",
            data = { FallbackRefillOneUse = false, FallbackRefillType = "black", width = 32, height = 32, OutlineColor = "433655", InfillColor = "000000", InfillOpacity = 0.3 }
        },
        {
            name = "rose",
            data = { FallbackRefillOneUse = false, FallbackRefillType = "rose", width = 32, height = 32, OutlineColor = "f65e89", InfillColor = "9d304f", InfillOpacity = 0.3 }
        },
        {
            name = "cyan",
            data = { FallbackRefillOneUse = false, FallbackRefillType = "cyan", width = 32, height = 32, OutlineColor = "a5adff", InfillColor = "5369b3", InfillOpacity = 0.3 }
        },
        {
            name = "gold",
            data = { FallbackRefillOneUse = false, FallbackRefillType = "gold", width = 32, height = 32, OutlineColor = "d3c487", InfillColor = "a17b4a", InfillOpacity = 0.3 }
        },
        {
            name = "dark_green",
            data = { FallbackRefillOneUse = false, FallbackRefillType = "dark_green", width = 32, height = 32, OutlineColor = "7ac533", InfillColor = "435e28", InfillOpacity = 0.3 }
        },
    },
    fieldInformation = {
        OutlineColor = { fieldType = "color" }, InfillColor = { fieldType = "color" },
    },
    ignoredFields = {"_name", "_id", "originX", "originY", "Radius"},
    sprite = function(room, entity)
        entity.Radius = math.min(entity.width / 2, entity.height / 2)
        local outlineColor = scughelper.parseColor(entity.OutlineColor)
        local infillColor = scughelper.parseColor(entity.InfillColor)
        infillColor[4] = entity.InfillOpacity
        return drawableFunc.fromFunction(function()
            drawing.callKeepOriginalColor(function()
                love.graphics.setColor(infillColor)
                love.graphics.circle("fill", entity.x + entity.Radius, entity.y + entity.Radius, entity.Radius - 2);
                love.graphics.setColor(outlineColor)
                love.graphics.circle("line", entity.x + entity.Radius, entity.y + entity.Radius, entity.Radius);
            end)
        end)
    end
}
