<?xml version="1.0" encoding="UTF-8"?>

<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
<?import org.cryptomator.ui.controls.FormattedLabel?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.control.Hyperlink?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Region?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Circle?>
<VBox xmlns:fx="http://javafx.com/fxml"
	  xmlns="http://javafx.com/javafx"
	  fx:controller="org.cryptomator.ui.error.ErrorController"
	  prefWidth="450"
	  prefHeight="450"
	  spacing="18"
	  alignment="TOP_CENTER">
	<padding>
		<Insets topRightBottomLeft="24"/>
	</padding>
	<children>
		<HBox spacing="12" VBox.vgrow="NEVER">
			<StackPane alignment="CENTER" HBox.hgrow="NEVER">
				<Circle styleClass="glyph-icon-primary" radius="24"/>
				<FontAwesome5IconView styleClass="glyph-icon-white" glyph="EXCLAMATION" glyphSize="24"/>
			</StackPane>
			<VBox spacing="6" HBox.hgrow="ALWAYS">
				<FormattedLabel styleClass="label-extra-large" format="%error.message" arg1="${controller.errorCode}"/>
				<Label text="%error.description" wrapText="true"/>
				<Hyperlink styleClass="hyperlink-underline" text="%error.hyperlink.lookup" onAction="#searchError" contentDisplay="LEFT">
					<graphic>
						<FontAwesome5IconView glyph="LINK" glyphSize="12"/>
					</graphic>
				</Hyperlink>
				<Hyperlink styleClass="hyperlink-underline" text="%error.hyperlink.report" onAction="#reportError" contentDisplay="LEFT">
					<graphic>
						<FontAwesome5IconView glyph="LINK" glyphSize="12"/>
					</graphic>
				</Hyperlink>
			</VBox>
		</HBox>

		<VBox spacing="6" VBox.vgrow="ALWAYS">
			<HBox>
				<Label text="%error.technicalDetails"/>
				<Region HBox.hgrow="ALWAYS"/>
				<Hyperlink styleClass="hyperlink-underline" text="%generic.button.copy" onAction="#copyDetails" contentDisplay="LEFT" visible="${!controller.copiedDetails}" managed="${!controller.copiedDetails}">
					<graphic>
						<FontAwesome5IconView glyph="CLIPBOARD" glyphSize="12"/>
					</graphic>
				</Hyperlink>
				<Hyperlink styleClass="hyperlink-underline" text="%generic.button.copied" onAction="#copyDetails" contentDisplay="LEFT" visible="${controller.copiedDetails}" managed="${controller.copiedDetails}">
					<graphic>
						<FontAwesome5IconView glyph="CHECK" glyphSize="12"/>
					</graphic>
				</Hyperlink>
			</HBox>
			<TextArea VBox.vgrow="ALWAYS" text="${controller.detailText}" prefRowCount="5" editable="false"/>
		</VBox>

		<ButtonBar buttonMinWidth="120" buttonOrder="B+C">
			<buttons>
				<Button text="%generic.button.back" ButtonBar.buttonData="BACK_PREVIOUS" onAction="#back" visible="${controller.previousScenePresent}"/>
				<Button text="%generic.button.cancel" ButtonBar.buttonData="CANCEL_CLOSE" onAction="#close"/>
			</buttons>
		</ButtonBar>
	</children>
</VBox>
