<script module lang="ts">
	import { defineMeta } from "@storybook/addon-svelte-csf";
	import MockAuthProvider from "$lib/components/testing/MockAuthProvider.svelte";
	import RepoCard from "./RepoCard.svelte";
	import type { RepoCardData } from "$lib/components/profile/types";

	const repo: RepoCardData = {
		name: "core",
		repoDid: "did:plc:3p7ejjxnufohsygt5vbyxb2i",
		ownerHandle: "tangled.org",
		description: "The knot server, appview, and everything that makes tangled tick.",
		createdAt: "2025-06-01T10:30:00Z",
		language: "Go",
		stars: 42,
		forks: 7,
		issues: 3,
		pulls: 5,
		viewerStarRkey: null
	};

	const { Story } = defineMeta({
		title: "Repo/RepoCard",
		component: RepoCard,
		tags: ["autodocs"],
		argTypes: {
			starButton: { control: "boolean" },
			showOwner: { control: "boolean" },
			border: { control: "boolean" },
			shadow: { control: "boolean" },
			background: { control: "boolean" }
		},
		args: {
			repo,
			starButton: false,
			showOwner: true,
			border: true,
			shadow: false,
			background: true
		}
	});
</script>

<Story name="Default" />
<Story name="No owner" args={{ showOwner: false }} />
<Story name="Elevated" args={{ shadow: true }} />
<Story name="Plain (timeline)" args={{ border: false, shadow: false, background: false }} />

<Story name="With star button">
	{#snippet template(args)}
		<MockAuthProvider>
			<RepoCard {...args} starButton />
		</MockAuthProvider>
	{/snippet}
</Story>
