<script setup>
import {
	Body,
	Container,
	Heading,
	Html,
	Img,
	Preview,
	Text,
} from '@vue-email/components';

defineProps({
	user: {
		type: Object,
		default: () => mockUser,
	},
	address: {
		type: String,
		default: 'http://localhost:5100',
	},
});
</script>

<script>
// defineProps' default factory (above, in <script setup>) references this. It must live in a plain
// <script> block: Vue's compiler forbids defineProps from referencing variables declared inside
// <script setup> itself, since that block gets hoisted out of the setup() function.
const mockUser = {
	id: 1,
	username: 'DebuggingLibrarian',
	email: 'debug@alerts.traxxx.me',
};
</script>

<template>
	<Html>
		<Body style="font-family: sans-serif;">
			<Preview>Someone tried to use this e-mail address for traxxx</Preview>

			<Container>
				<Img
					:src="`${address}/img/logo.png`"
					width="150"
					alt="traxxx"
					style="margin: 15px auto 25px auto;"
				/>

				<Heading
					as="h3"
					style="color: #f65596; margin: 0 auto 0 auto;"
				>Hi, {{ user.username }}</Heading>

				<Heading
					as="h3"
					style="margin-top: 30px;"
				>Someone tried to assign this e-mail address to a traxxx account.</Heading>

				<Text style="font-size: 16px; margin: 20px 0;">If this was you with this account ({{ user.username }}), your e-mail address is already set correctly. If this was you with another account, you will need to use another e-mail address. If this was not you, you can safely ignore this e-mail.</Text>
			</Container>
		</Body>
	</Html>
</template>
