export type ReviewSeverity = 'info' | 'warning' | 'error' | 'suggestion'; export type ReviewCategory = | 'style' | 'logic' | 'security' | 'performance' | 'maintainability' | 'documentation' | 'testing' | 'accessibility'; export interface ReviewComment { readonly id: string; readonly filePath: string; readonly lineNumber?: number; readonly message: string; readonly severity: ReviewSeverity; readonly category: ReviewCategory; readonly suggestion?: string; readonly codeSnippet?: string; readonly metadata?: Record; } export interface ReviewCommentBuilder { id(id: string): ReviewCommentBuilder; filePath(filePath: string): ReviewCommentBuilder; lineNumber(lineNumber: number): ReviewCommentBuilder; message(message: string): ReviewCommentBuilder; severity(severity: ReviewSeverity): ReviewCommentBuilder; category(category: ReviewCategory): ReviewCommentBuilder; suggestion(suggestion: string): ReviewCommentBuilder; codeSnippet(codeSnippet: string): ReviewCommentBuilder; metadata(metadata: Record): ReviewCommentBuilder; build(): ReviewComment; } export class ReviewCommentImpl implements ReviewCommentBuilder { private comment: any = {}; id(id: string): ReviewCommentBuilder { this.comment.id = id; return this; } filePath(filePath: string): ReviewCommentBuilder { this.comment.filePath = filePath; return this; } lineNumber(lineNumber: number): ReviewCommentBuilder { this.comment.lineNumber = lineNumber; return this; } message(message: string): ReviewCommentBuilder { this.comment.message = message; return this; } severity(severity: ReviewSeverity): ReviewCommentBuilder { this.comment.severity = severity; return this; } category(category: ReviewCategory): ReviewCommentBuilder { this.comment.category = category; return this; } suggestion(suggestion: string): ReviewCommentBuilder { this.comment.suggestion = suggestion; return this; } codeSnippet(codeSnippet: string): ReviewCommentBuilder { this.comment.codeSnippet = codeSnippet; return this; } metadata(metadata: Record): ReviewCommentBuilder { this.comment.metadata = metadata; return this; } build(): ReviewComment { if (!this.comment.id || !this.comment.filePath || !this.comment.message || !this.comment.severity || !this.comment.category) { throw new Error('Required fields missing for ReviewComment'); } const result: any = { id: this.comment.id, filePath: this.comment.filePath, message: this.comment.message, severity: this.comment.severity, category: this.comment.category, }; if (this.comment.lineNumber !== undefined) { result.lineNumber = this.comment.lineNumber; } if (this.comment.suggestion) { result.suggestion = this.comment.suggestion; } if (this.comment.codeSnippet) { result.codeSnippet = this.comment.codeSnippet; } if (this.comment.metadata) { result.metadata = this.comment.metadata; } return result; } }