export type BrowserStats = {
  profileCount: number;
  extensionCount: number;
  bookmarkCount: number;
};

export type ProfileSummary = {
  id: string;
  name: string;
  email: string | null;
  avatarDataUrl: string | null;
  avatarIcon: string | null;
  defaultAvatarFillColor: number | null;
  defaultAvatarStrokeColor: number | null;
  avatarLabel: string;
  path: string;
};

export type ExtensionSummary = {
  id: string;
  name: string;
  version: string | null;
  iconDataUrl: string | null;
  profileIds: string[];
  profiles: AssociatedProfileSummary[];
};

export type BookmarkSummary = {
  url: string;
  title: string;
  profileIds: string[];
  profiles: BookmarkAssociatedProfileSummary[];
};

export type AssociatedProfileSummary = {
  id: string;
  name: string;
  avatarDataUrl: string | null;
  avatarIcon: string | null;
  defaultAvatarFillColor: number | null;
  defaultAvatarStrokeColor: number | null;
  avatarLabel: string;
};

export type BookmarkAssociatedProfileSummary = {
  id: string;
  name: string;
  avatarDataUrl: string | null;
  avatarIcon: string | null;
  defaultAvatarFillColor: number | null;
  defaultAvatarStrokeColor: number | null;
  avatarLabel: string;
  bookmarkPath: string;
};

export type ProfileSortKey = "name" | "email" | "id";
export type ExtensionSortKey = "name" | "id";
export type BookmarkSortKey = "title" | "url";
export type AssociatedProfileSortKey = "id" | "name";
export type ActiveSection = "profiles" | "extensions" | "bookmarks";
export type AppPage = "browserData" | "configuration";
export type BrowserConfigSource = "default" | "custom";

export type BrowserConfigEntry = {
  id: string;
  source: BrowserConfigSource;
  browserFamilyId: string | null;
  iconKey: string | null;
  name: string;
  executablePath: string;
  userDataPath: string;
  deletable: boolean;
};

export type BrowserConfigListResponse = {
  configs: BrowserConfigEntry[];
};

export type CreateCustomBrowserConfigInput = {
  name: string;
  iconKey: string | null;
  executablePath: string;
  userDataPath: string;
};

export type BrowserView = {
  browserId: string;
  browserFamilyId: string | null;
  browserName: string;
  iconKey: string | null;
  dataRoot: string;
  profiles: ProfileSummary[];
  extensions: ExtensionSummary[];
  bookmarks: BookmarkSummary[];
  stats: BrowserStats;
};

export type ScanResponse = {
  browsers: BrowserView[];
};
