<script lang="ts">
	import { DateTime } from 'luxon';
	interface Auction {
		id: number;
		fingerprint: string;
		title: string;
		description: string;
		items: number;
		sourceSiteName: string;
		sourceSiteURL: string;
		sourceURL: string;
		start: string;
		end: string;
		country: string;
		province: string;
	}

	export let auction: Auction;

	const {
		id,
		title,
		description,
		items,
		sourceSiteName,
		sourceSiteURL,
		sourceURL,
		start,
		country,
		province
	} = auction;

	const saleStartTime = DateTime.fromISO(start);
</script>

<article class="auction-result flex flex-col py-3 shadow-sm border-b-2 border-bh-gold">
	<header class="pb-2">
		<h2 class="text-lg">
			<a href={sourceURL} target="_blank">{title}</a>
		</h2>
	</header>
	<section>
		<ul>
			<li class="text-sm">Starts {saleStartTime?.toLocaleString(DateTime.DATETIME_FULL)}</li>
			<li class="text-sm">{province}, {country?.toUpperCase()}</li>
			<li class="text-sm">{items} Items</li>
			<li class="text-sm">
				Available at <a href={sourceSiteURL} target="_blank">{sourceSiteName}</a>
			</li>
			<li class="py-2">
				<p>{@html description}</p>
			</li>
		</ul>
	</section>
</article>
