export interface DiffHunk {
  header: string;
  oldStart: number;
  oldCount: number;
  newStart: number;
  newCount: number;
  lines: DiffLine[];
}

export interface DiffLine {
  type: "added" | "removed" | "context";
  content: string;
  oldLineNumber: number | null;
  newLineNumber: number | null;
}

/** Metadata returned by getPhaseReviewDiff — no hunk content */
export interface FileDiff {
  oldPath: string;
  newPath: string;
  /** 'binary' is new — prior changeType used FileChangeType which had no 'binary' */
  status: 'added' | 'modified' | 'deleted' | 'renamed' | 'binary';
  additions: number;
  deletions: number;
  projectId?: string;  // present in multi-project initiatives
}

/** Full diff with parsed hunks — returned by getFileDiff, parsed client-side */
export interface FileDiffDetail extends FileDiff {
  hunks: DiffHunk[];
}

export interface ReviewComment {
  id: string;
  filePath: string;
  lineNumber: number | null; // null = file-level comment
  lineType: "added" | "removed" | "context";
  body: string;
  author: string;
  createdAt: string;
  resolved: boolean;
  parentCommentId?: string | null;
}

export type ReviewStatus = "pending" | "approved" | "changes_requested";

export interface CommitInfo {
  hash: string;
  shortHash: string;
  message: string;
  author: string;
  date: string;
  filesChanged: number;
  insertions: number;
  deletions: number;
}

export interface ReviewSummary {
  id: string;
  title: string;
  description: string;
  author: string;
  status: ReviewStatus;
  comments: ReviewComment[];
  files: FileDiff[];
  createdAt: string;
  sourceBranch: string;
  targetBranch: string;
}
