// view models produced by the profile route loads and consumed by the cards.

export interface ProfileCounts {
	repos: number;
	stars: number;
	strings: number;
	followers: number;
	following: number;
	vouches: number;
}

export interface RepoCardData {
	rkey?: string;
	name: string;
	repoDid: string;
	ownerHandle: string;
	description?: string;
	knot?: string;
	createdAt: string;
	language?: string;
	stars?: number;
	forks?: number;
	issues?: number;
	pulls?: number;
	viewerStarRkey?: string | null;
}

// legacy repos have no repoDid
export const repoKey = (repo: RepoCardData): string => repo.repoDid || repo.rkey || repo.name;

export interface StringCardData {
	rkey: string;
	ownerHandle: string;
	filename: string;
	description: string;
	createdAt: string;
	lines: number;
}

export interface FollowChange {
	viewerDid: string;
	subjectDid: string;
	following: boolean;
	rkey: string | null;
	delta: 1 | -1;
}

export interface PersonData {
	did: string;
	handle: string;
	description?: string;
	followers?: number;
	following?: number;
	viewerFollowRkey?: string | null;
	isSelf?: boolean;
}

export interface VouchData {
	uri: string;
	did: string;
	handle: string;
	kind: "vouch" | "denounce";
	direction: "incoming" | "outgoing";
	reason?: string;
	createdAt: string;
}

export type StarData =
	| { kind: "repo"; uri: string; createdAt: string; repo: RepoCardData }
	| { kind: "string"; uri: string; createdAt: string; ownerHandle: string; rkey: string };
