from django import template

register = template.Library()

STATUS_COLORS = {
    "draft": "bg-slate-100 text-slate-600",
    "in_progress": "bg-blue-100 text-blue-700",
    "review": "bg-yellow-100 text-yellow-700",
    "approved": "bg-green-100 text-green-700",
    "closed": "bg-slate-100 text-slate-500",
}

SEVERITY_COLORS = {
    "low": "bg-green-100 text-green-700",
    "medium": "bg-yellow-100 text-yellow-700",
    "high": "bg-orange-100 text-orange-700",
    "critical": "bg-red-500 text-white",
}

ACTION_STATUS_COLORS = {
    "not_started": "bg-slate-100 text-slate-600",
    "in_progress": "bg-blue-100 text-blue-700",
    "completed": "bg-green-100 text-green-700",
    "cancelled": "bg-red-100 text-red-700",
}


@register.filter
def status_color(value):
    return STATUS_COLORS.get(value, "bg-slate-100 text-slate-600")


@register.filter
def severity_color(value):
    return SEVERITY_COLORS.get(value, "bg-slate-100 text-slate-600")


@register.filter
def action_status_color(value):
    return ACTION_STATUS_COLORS.get(value, "bg-slate-100 text-slate-600")
