from metrics_framework.decorators import metric

from idm.core.models import Role


@metric('hanging_roles')
def hanging_roles():
    result = []
    for method in ('hanging_approved', 'hanging_depriving'):
        result.append({
            'slug': method,
            'value': getattr(Role.objects, method)().count(),
        })

    return result
