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

<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.ToggleGroup?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<VBox xmlns:fx="http://javafx.com/fxml"
	  xmlns="http://javafx.com/javafx"
	  fx:controller="org.cryptomator.ui.vaultoptions.MountOptionsController"
	  spacing="6">
	<fx:define>
		<ToggleGroup fx:id="mountPoint"/>
	</fx:define>
	<padding>
		<Insets topRightBottomLeft="12"/>
	</padding>
	<children>
		<CheckBox fx:id="readOnlyCheckbox" text="%vaultOptions.mount.readonly"/>

		<CheckBox fx:id="customMountFlagsCheckbox" text="%vaultOptions.mount.customMountFlags" onAction="#toggleUseCustomMountFlags" visible="${controller.customMountOptionsSupported}" managed="${controller.customMountOptionsSupported}"/>

		<TextField fx:id="mountFlags" HBox.hgrow="ALWAYS" maxWidth="Infinity">
			<VBox.margin>
				<Insets left="24"/>
			</VBox.margin>
		</TextField>

		<Label text="%vaultOptions.mount.mountPoint">
			<VBox.margin>
				<Insets top="9"/>
			</VBox.margin>
		</Label>
		<RadioButton toggleGroup="${mountPoint}" fx:id="mountPointAuto" text="%vaultOptions.mount.mountPoint.auto"/>
		<HBox spacing="6" visible="${controller.osWindows}" managed="${controller.osWindows}">
			<RadioButton toggleGroup="${mountPoint}" fx:id="mountPointWinDriveLetter" text="%vaultOptions.mount.mountPoint.driveLetter"/>
			<ChoiceBox fx:id="driveLetterSelection" disable="${!mountPointWinDriveLetter.selected}"/>
		</HBox>
		<HBox fx:id="customMountPointRadioBtn" spacing="6" alignment="CENTER_LEFT" visible="${controller.customMountOptionsSupported}" managed="${controller.customMountOptionsSupported}">
			<RadioButton toggleGroup="${mountPoint}" fx:id="mountPointCustomDir" text="%vaultOptions.mount.mountPoint.custom" />
			<Button text="%vaultOptions.mount.mountPoint.directoryPickerButton" onAction="#chooseCustomMountPoint" contentDisplay="LEFT" disable="${!mountPointCustomDir.selected}">
				<graphic>
					<FontAwesome5IconView glyph="FOLDER_OPEN" glyphSize="15"/>
				</graphic>
			</Button>
		</HBox>
		<TextField text="${controller.customMountPath}" visible="${mountPointCustomDir.selected}" maxWidth="Infinity" disable="true" managed="${customMountPointRadioBtn.managed}">
			<VBox.margin>
				<Insets left="24"/>
			</VBox.margin>
		</TextField>
	</children>

</VBox>
