export interface Task {
  id: string;
  title: string;
  planned: boolean;
  executed: boolean;
  filename: string;
  /** ISO 8601 — file birth time when available, else modification time. */
  createdAt: string;
  /** ISO 8601 — last modification time. */
  modifiedAt: string;
}

export interface Initiative {
  id: string;
  title: string;
  parent: string | null;
  deps: string[];
  split: boolean;
  planned: boolean;
  executed: boolean;
  depth: number;
  filename: string;
  content: string;
  format: "flat" | "directory";
  priority: number;      // 1=highest (top of queue), 5=lowest, 0=unset
  author?: string;
  taskCount?: number;
  tasksExecuted?: number;
  screenshotCount?: number;
  progressSnippet?: string;
  iterationStatus?: string;
}

export interface ProjectStatus {
  projectId: string;
  description: string;
  updated: string;
  iteration: number;
  phase: string;
  details: string;
  raw: string;
}

export interface ProcessInfo {
  pid: number | null;
  running: boolean;
  stopping: boolean;
  uptime: string | null;
  command: string | null;
}

export interface Screenshot {
  filename: string;
  path: string;
  modified: number;
  size: number;
}

export interface Project {
  id: string;
  name: string;
  projectDir: string;
  autobuilderDir: string;
  status: ProjectStatus | null;
  process: ProcessInfo;
  /** Task- and initiative-level stats (directory initiatives + legacy flat files). */
  initiativeCounts: {
    /** Number of initiatives (folders or flat initiative files). */
    initiativeCount: number;
    /** Total task files across all initiatives. */
    tasksTotal: number;
    /** Tasks with executed: true across all initiatives. */
    tasksExecuted: number;
  };
  hasLog: boolean;
  logSize: number;
  screenshotCount: number;
  scopeSnippet: string;
  activeInitiative: string | null;
  gitBranch: string;
  lastCommit: string;
}

export interface ProjectConfig {
  name: string;
  dir: string;
  autobuilderDir: string;
  port?: number;
}

export interface DashboardConfig {
  projects: ProjectConfig[];
}
