export type ChronicleDetailLevel = 'simple' | 'standard' | 'detailed';

export interface ProjectProfile {
    projectId: string;
    projectName: string;
    projectRoot?: string;
    recordRoot: string;
    description?: string;
    corePurpose?: string;
    targetUsers?: string[];
    avoidDirections?: string[];
    detailLevel: ChronicleDetailLevel;
    createdAt: string;
    updatedAt: string;
    // ── Project Architecture Context (Feature 2) ───────────────────────────────
    /** Absolute path to the auto-generated architecture markdown. */
    architectureDocPath?: string;
    /** When true, the architecture doc is auto-attached to every prompt. */
    architectureAutoAttach?: boolean;
    /** When true, file changes under projectRoot trigger a debounced refresh. */
    architectureAutoUpdate?: boolean;
    /** ISO timestamp of the last (auto or manual) refresh. */
    architectureLastUpdated?: string;
    /**
     * Cheap hash of the inputs used by the last scan (package.json + top-level tree).
     * Used by the file watcher to skip no-op regenerations.
     */
    architectureLastScanSignature?: string;
}

export interface QuestionRecord {
    question: string;
    reason: string;
    expectedInformation: string;
    impactOnDecision: string;
    userAnswer?: string;
    result?: string;
}

export interface DecisionRecord {
    title: string;
    status: 'accepted' | 'rejected' | 'deferred' | 'changed';
    context: string;
    decision: string;
    reason: string;
    alternatives?: string[];
    consequences?: string[];
    createdAt?: string;
}

export interface PlanningDocument {
    featureName: string;
    purpose: string;
    background: string;
    userIntent: string;
    scope: string[];
    outOfScope: string[];
    developmentDirection: string;
    dependencyStrategy: string;
    expectedValue: string;
    successCriteria: string[];
    developerInstruction: string;
    sourceRequest?: string;
    createdAt?: string;
}

export interface DiscussionRecord {
    title: string;
    userRequest: string;
    interpretedIntent: string;
    questions: QuestionRecord[];
    discussions: string[];
    decisions: DecisionRecord[];
    createdAt?: string;
}

export interface DevelopmentLog {
    featureName: string;
    purpose: string;
    implementationSummary: string;
    architecture: string;
    changedFiles: string[];
    dependencyNotes: string;
    bugs: BugRecord[];
    lessons: string[];
    createdAt?: string;
}

export interface BugRecord {
    title: string;
    symptom: string;
    cause: string;
    fix: string;
    prevention: string;
    createdAt?: string;
}

export interface RetrospectiveRecord {
    title: string;
    summary: string;
    wentWell: string[];
    toImprove: string[];
    nextActions: string[];
    createdAt?: string;
}

export interface ChronicleWriteResult {
    filePath: string;
    relativePath: string;
}

export interface ChronicleRecordEntry {
    section: string;
    fileName: string;
    filePath: string;
    relativePath: string;
    updatedAt: number;
}
