export interface ITaskStep { name: string; description: string; percentage: number; // Weight of this step (0-100) status: 'pending' | 'active' | 'completed'; startTime?: number; endTime?: number; duration?: number; } export class TaskStep implements ITaskStep { public name: string; public description: string; public percentage: number; public status: 'pending' | 'active' | 'completed' = 'pending'; public startTime?: number; public endTime?: number; public duration?: number; constructor(config: { name: string; description: string; percentage: number }) { this.name = config.name; this.description = config.description; this.percentage = config.percentage; } public start(): void { this.status = 'active'; this.startTime = Date.now(); } public complete(): void { if (this.startTime) { this.endTime = Date.now(); this.duration = this.endTime - this.startTime; } this.status = 'completed'; } public reset(): void { this.status = 'pending'; this.startTime = undefined; this.endTime = undefined; this.duration = undefined; } public toJSON(): ITaskStep { return { name: this.name, description: this.description, percentage: this.percentage, status: this.status, startTime: this.startTime, endTime: this.endTime, duration: this.duration, }; } }