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

<?import org.cryptomator.ui.controls.FormattedLabel?>
<?import org.cryptomator.ui.controls.NiceSecurePasswordField?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ProgressBar?>
<?import javafx.scene.layout.VBox?>
<?import org.cryptomator.ui.controls.FontAwesome5Spinner?>
<VBox xmlns:fx="http://javafx.com/fxml"
	  xmlns="http://javafx.com/javafx"
	  fx:controller="org.cryptomator.ui.migration.MigrationRunController"
	  minWidth="400"
	  maxWidth="400"
	  minHeight="145"
	  spacing="12">
	<padding>
		<Insets topRightBottomLeft="12"/>
	</padding>
	<children>
		<VBox spacing="6" visible="${!controller.vault.processing}" managed="${!controller.vault.processing}">
			<FormattedLabel format="%migration.run.enterPassword" arg1="${controller.vault.displayName}" wrapText="true"/>
			<NiceSecurePasswordField fx:id="passwordField"/>
		</VBox>

		<VBox spacing="6" visible="${controller.vault.processing}" managed="${controller.vault.processing}">
			<Label text="%migration.run.progressHint" wrapText="true"/>
			<ProgressBar progress="${controller.migrationProgress}" prefWidth="Infinity"/>
		</VBox>

		<VBox alignment="BOTTOM_CENTER" VBox.vgrow="ALWAYS">
			<ButtonBar buttonMinWidth="120" buttonOrder="B+X">
				<buttons>
					<Button text="%generic.button.back" ButtonBar.buttonData="BACK_PREVIOUS" cancelButton="true" onAction="#back" disable="${controller.vault.processing}"/>
					<Button text="%migration.run.startMigrationBtn" ButtonBar.buttonData="NEXT_FORWARD" defaultButton="true" onAction="#migrate" contentDisplay="${controller.migrateButtonContentDisplay}"
							disable="${controller.migrationButtonDisabled}">
						<graphic>
							<FontAwesome5Spinner glyphSize="12" />
						</graphic>
					</Button>
				</buttons>
			</ButtonBar>
		</VBox>
	</children>
</VBox>