{# @var state \Ferienpass\CoreBundle\ConsentManager\ConsentState #}
{% set icon = 'ph:circle-dashed' %}
{% if state.isAcknowledged() %}
    {% if state.isSigned() %}
        {% set icon = 'ph:check-circle-fill' %}
    {% elseif state.isRejected() %}
        {% set icon = 'ph:x-circle-fill' %}
    {% else %}
        {% set icon = 'ph:circle-fill' %}
    {% endif %}
{% elseif not state.isCompulsory() %}
    {% if state.isOptOut() %}
        {% set icon = 'ph:check-circle' %}
    {% elseif state.isOptIn() %}
        {% set icon = 'ph:x-circle' %}
    {% endif %}
{% endif %}

{% set color = 'text-orange-500' %}
{% if state.isSigned() or (not state.isAcknowledged() and state.isOptOut() and not state.isCompulsory()) %}
    {% set color = 'text-green-500' %}
{% elseif state.isRejected() or (not state.isAcknowledged() and state.isOptIn() and not state.isCompulsory()) %}
    {% set color = 'text-red-500' %}
{% endif %}

<twig:ux:icon
    name="{{ icon }}"
    class="{{ class|default('h-4 w-4') }} flex-shrink-0 {{ color }}"
/>
