<script lang="ts">
	import Button from "$lib/components/ui/Button.svelte";
	import Input from "$lib/components/ui/Input.svelte";
	import DrillDown from "$lib/components/settings/DrillDown.svelte";
	import SettingsList from "$lib/components/settings/SettingsList.svelte";
	import FormRow from "$lib/components/settings/FormRow.svelte";
	import FormActions from "$lib/components/settings/FormActions.svelte";
	import Mail from "$icon/mail";
	import X from "$icon/x";

	let password = $state("");
	const valid = $derived(password.length > 0);
</script>

<DrillDown
	backLabel="Profile"
	backHref="/settings"
	title="Delete account"
	description="This permanently deletes your account and all associated data. This cannot be undone."
>
	<SettingsList padding="tight">
		<FormRow label="Password" description="Confirm your identity to proceed." for="delete-password">
			<Input id="delete-password" type="password" bind:value={password} />
		</FormRow>
	</SettingsList>

	<FormActions>
		<Button href="/settings" icon={X}>Cancel</Button>
		<!-- mocked — account lifecycle is backed by G4 -->
		<Button variant="danger" icon={Mail} disabled={!valid}>Send deletion code</Button>
	</FormActions>
</DrillDown>
