<xf:macro id="key_type" arg-apiKey="!">
	<xf:if is="$apiKey.key_type == 'super'">
		{{ phrase('super_user_key') }}
	<xf:elseif is="$apiKey.key_type == 'user'"/>
		{{ phrase('user_key') }}:
		<xf:username user="$apiKey.User" href="" defaultname="{{ phrase('deleted_member') }}"/>
	<xf:else/>
		{{ phrase('guest_key') }}
	</xf:if>
</xf:macro>

<xf:macro id="key_type_row" arg-apiKey="!">
	<xf:formrow label="{{ phrase('key_type') }}"
		explain="{{ phrase('cannot_be_changed_after_creation_requires_new_api_key') }}">
		<xf:macro id="key_type" arg-apiKey="{$apiKey}" />
	</xf:formrow>
</xf:macro>

<xf:macro id="copy_key_row" arg-apiKey="!">
	<xf:formrow label="{{ phrase('api_key') }}" rowtype="button">
		<xf:macro id="copy_key" arg-apiKey="{$apiKey}" />

		<div class="formRow-explain">
			<xf:macro id="key_usage" arg-apiKey="{$apiKey}" />
		</div>
	</xf:formrow>
</xf:macro>

<xf:macro id="copy_key" arg-apiKey="!">
	<code class="js-copyTarget">{$apiKey.api_key}</code>
	<xf:button icon="copy"
		data-xf-init="copy-to-clipboard"
		data-copy-target=".js-copyTarget"
		data-success="{{ phrase('api_key_copied_to_clipboard') }}"
		class="button--link is-hidden" />
</xf:macro>

<xf:macro id="key_usage" arg-apiKey="!">
	{{ phrase('key_provided_to_api_via_header') }}

	<xf:if is="$apiKey.key_type == 'super'">
		{{ phrase('as_super_user_key_include_user_header') }}
	</xf:if>
</xf:macro>