export type Icon = "agentoast" | "claude-code" | "codex" | "copilot-cli" | "opencode";
export type AgentStatus = "running" | "idle" | "waiting";

export type UpdateStatus =
  | { status: "idle" }
  | { status: "checking" }
  | { status: "up-to-date" }
  | { status: "downloading"; progress: number }
  | { status: "installing" }
  | { status: "ready" }
  | { status: "error"; message: string };

export interface Notification {
  id: number;
  badge: string;
  body: string;
  badgeColor: string;
  icon: Icon;
  metadata: Record<string, string>;
  repo: string;
  tmuxPane: string;
  terminalBundleId: string;
  forceFocus: boolean;
  isRead: boolean;
  createdAt: string;
}

export interface MuteState {
  globalMuted: boolean;
  mutedRepos: string[];
}

export interface TmuxPane {
  paneId: string;
  panePid: number;
  sessionName: string;
  windowName: string;
  currentPath: string;
  isActive: boolean;
  agentType: Icon | null;
  agentStatus: AgentStatus | null;
  waitingReason: string | null;
  agentModes: string[];
  teamRole: "lead" | "teammate" | null;
  teamName: string | null; // "@agent-alpha" for teammates
  gitRepoRoot: string | null;
  gitBranch: string | null;
  currentCommand: string | null;
}

export interface TmuxPaneGroup {
  repoName: string;
  currentPath: string;
  gitBranch: string | null;
  panes: TmuxPane[];
}

export interface PaneItem {
  pane: TmuxPane;
  notification: Notification | null;
}

export interface UnifiedGroup {
  groupKey: string;
  repoName: string;
  gitBranch: string | null;
  paneItems: PaneItem[];
}

export type FlatItem =
  | { type: "group-header"; groupKey: string }
  | { type: "pane-item"; groupKey: string; paneItem: PaneItem };

export type PanelView = "main" | "apps";

export interface RunningApp {
  bundleId: string;
  name: string;
  iconDataUrl: string;
}

export interface AllowedApp {
  bundleId: string;
  displayName: string;
}
