{% macro default(message, icon, type, header) %}
    {% if isFrontOffice is defined and isFrontOffice == true %}
        {% set bootstrap = type %}
        {% if type == 'negative' %}
            {% set bootstrap = 'danger' %}
        {% endif %}

        <p class="alert alert-{{ bootstrap|default('success') }}" {{ sylius_test_html_attribute('flash-message', type) }}>
            {{ message|trans }}
        </p>
    {% else %}
        <div class="ui icon {{ type|default('') }} message" {{ sylius_test_html_attribute('flash-message', type) }}>
            <i class="{{ icon }} icon"></i>
            <div class="content">
                {% if type is not empty %}
                    <div class="header">
                        {{ header|default(type)|trans }}
                    </div>
                {% endif %}
                <p>{{ message|trans }}</p>
            </div>
        </div>
    {% endif %}
{% endmacro %}

{% macro info(message) %}
    {% import _self as messages %}
    {% if isFrontOffice is defined and isFrontOffice == true %}
        {{ messages.default(message, 'info-circle', 'info', 'sylius.ui.info') }}
    {% else %}
        {{ messages.default(message, 'info circle', 'info', 'sylius.ui.info') }}
    {% endif %}
{% endmacro %}

{% macro success(message) %}
    {% import _self as messages %}
    {% if isFrontOffice is defined and isFrontOffice == true %}
        {{ messages.default(message, 'check', 'success', 'sylius.ui.success') }}
    {% else %}
        {{ messages.default(message, 'checkmark', 'success', 'sylius.ui.success') }}
    {% endif %}
{% endmacro %}

{% macro error(message) %}
    {% import _self as messages %}
    {% if isFrontOffice is defined and isFrontOffice == true %}
        {{ messages.default(message, 'exclamation-circle', 'negative', 'sylius.ui.error') }}
    {% else %}
        {{ messages.default(message, 'remove', 'negative', 'sylius.ui.error') }}
    {% endif %}
{% endmacro %}
