from django import template

register = template.Library()


@register.filter
def status_label(value):
    from claims.models import Claim
    return dict(Claim.Status.choices).get(value, value)


@register.filter
def evidence_label(value):
    from claims.models import Claim
    return dict(Claim.EvidenceLevel.choices).get(value, value)


@register.filter
def quoted(value):
    if not value:
        return value
    return f'„{value}"'


@register.inclusion_tag('claims/partials/status_badge.html')
def status_badge(claim):
    return {'claim': claim}


@register.inclusion_tag('claims/partials/evidence_badge.html')
def evidence_badge(claim):
    return {'claim': claim}
