{% set tile_class = 'configure-zone-card operator-card-surface operator-tile-card status-' ~ tile.status %}
{% if tile.class_name is not empty %}
	{% set tile_class = tile_class ~ ' ' ~ tile.class_name %}
{% endif %}

{% set tile_body %}
	{% include '/wpadmin/components/operator/tile_content.twig' with { tile: tile } only %}
	{% if tile.action_label is not empty %}
		<div class="operator-tile-card__actions">
			<span class="operator-tile-card__action operator-tile-card__action--primary">{{ tile.action_label }}</span>
		</div>
	{% endif %}
	{% if tile.footer_links is not empty %}
		<div class="operator-tile-card__footer">
			{% for link in tile.footer_links %}
				<a class="operator-tile-card__footer-link"
				   href="{{ link.href }}"
				   {% if link.target is not empty %}target="{{ link.target }}"{% endif %}
				   {% if link.rel is not empty %}rel="{{ link.rel }}"{% endif %}>
					{{ link.label }}{% if link.icon_class is not empty %} <i class="bi {{ link.icon_class }}" aria-hidden="true"></i>{% endif %}
				</a>
			{% endfor %}
		</div>
	{% endif %}
{% endset %}

{% if tile.tag == 'button' %}
	<button type="button"
			class="{{ tile_class }}"
			{% if tile.data_drill_target is not empty %}data-drill-target="{{ tile.data_drill_target|e('html_attr') }}"{% endif %}
			{% if tile.data_drill_zone_selection is not empty %}data-drill-zone-selection="{{ tile.data_drill_zone_selection|e('html_attr') }}"{% endif %}
			{% if tile.data_drill_bucket_selection is not empty %}data-drill-bucket-selection="{{ tile.data_drill_bucket_selection|e('html_attr') }}"{% endif %}
			{% if tile.data_drill_group_selection is not empty %}data-drill-group-selection="{{ tile.data_drill_group_selection|e('html_attr') }}"{% endif %}
			{% if tile.data_reports_workspace_selection is not empty %}data-reports-workspace-selection="{{ tile.data_reports_workspace_selection|e('html_attr') }}"{% endif %}
			{% if tile.data_actions_queue_group_key is defined and tile.data_actions_queue_group_key is not empty %}data-actions-queue-group-key="{{ tile.data_actions_queue_group_key|e('html_attr') }}"{% endif %}
			{% if tile.data_pro_upsell is defined and tile.data_pro_upsell == '1' %}data-pro-upsell="1" aria-haspopup="dialog" aria-controls="ShieldModalContainer"{% endif %}
			{% if tile.data_enable_protection is defined and tile.data_enable_protection is not empty %}data-enable-protection="{{ tile.data_enable_protection|e('html_attr') }}" aria-haspopup="dialog"{% endif %}
			{% if tile.is_disabled %}disabled{% endif %}>
		{{ tile_body }}
	</button>
{% elseif tile.tag == 'a' %}
	<a class="{{ tile_class }}"
	   href="{{ tile.href }}"
	   {% if tile.target is not empty %}target="{{ tile.target }}"{% endif %}
	   {% if tile.rel is not empty %}rel="{{ tile.rel }}"{% endif %}
	   {% if tile.data_actions_queue_group_key is defined and tile.data_actions_queue_group_key is not empty %}data-actions-queue-group-key="{{ tile.data_actions_queue_group_key|e('html_attr') }}"{% endif %}>
		{{ tile_body }}
	</a>
{% else %}
	<div class="{{ tile_class }}"
		 {% if tile.data_actions_queue_group_key is defined and tile.data_actions_queue_group_key is not empty %}data-actions-queue-group-key="{{ tile.data_actions_queue_group_key|e('html_attr') }}"{% endif %}>
		{{ tile_body }}
	</div>
{% endif %}
