<script module lang="ts">
	import { defineMeta } from "@storybook/addon-svelte-csf";
	import RepoToolbar from "./RepoToolbar.svelte";
	import type { RepoInfo } from "./types";

	const repo: RepoInfo = {
		uri: "at://did:plc:repo/sh.tangled.repo.repo/3jzrepo",
		rkey: "3jzrepo",
		name: "tangled",
		ownerDid: "did:plc:owner",
		ownerHandle: "dawn",
		repoDid: "did:plc:repo",
		knot: "knot1.tangled.sh",
		defaultBranch: "main"
	};

	const { Story } = defineMeta({
		title: "Repo/RepoToolbar",
		component: RepoToolbar,
		tags: ["autodocs"],
		args: {
			repo,
			ref: "main",
			refs: { branches: ["main", "feature/storybook"], tags: ["v1.0.0"] },
			totalCommits: 42,
			totalBranches: 2,
			totalTags: 1,
			bobbinUrl: "https://bobbin.example.test"
		}
	});
</script>

<Story name="Branch and tag refs" />
<Story name="Detached commit ref" args={{ ref: "0123456789abcdef", totalCommits: 1 }} />
<Story
	name="Repository has no tags"
	args={{ refs: { branches: ["main"], tags: [] }, totalTags: 0 }}
/>
