وحدة:ملعب/Mohammed Qays/test1

local p = {}

function p.main(frame)
    local category = "صفحات نقاش حذف غير مغلقة"
    local count = tonumber(frame:preprocess("{{PAGESINCATEGORY:" .. category .. "|pages}}")) or 0

    -- تحديد الحالة واللون
    local thresholds = {
        {limit = 50, status = "قليلة", color = "green"},
        {limit = 100, status = "متوسطة", color = "blue"},
        {limit = math.huge, status = "عالية", color = "red"}
    }
    
    local status, color
    for _, t in ipairs(thresholds) do
        if count <= t.limit then
            status, color = t.status, t.color
            break
        end
    end

    return string.format([[
        <div style="border:1px solid #ddd; text-align:center; padding:10px; margin:10px 0;">
            <h3 style="margin:0 0 8px 0;">طلبات الحذف</h3>
            <div style="color:%s; margin-bottom:5px; font-weight:bold;">%s</div>
            <div>عدد طلبات الحذف المفتوحة: <b>%d</b></div>
        </div>
    ]], color, status, count)
end

return p