import { Stat } from "@/interfaces/user";

export interface ITrainingContent {
    id: string;
    created_at: number;
    user: string;
    exams: {
        id: string;
        date: number;
        detailed_summary: string;
        performance_comment: string;
        score: number;
        module: string;
        stat_ids: string[];
        stats?: Stat[];
    }[];
    tip_ids: string[];
    tips?: ITrainingTip[];
    weak_areas: {
        area: string;
        comment: string;
    }[];
}

export interface ITrainingTip {
    id: string;
    tipCategory: string;
    tipHtml: string;
    standalone: boolean;
    exercise?: {
        question: string;
        additional?: string;
        segments: WalkthroughConfigs[]
    }
}

export interface WalkthroughConfigs {
    html: string;
    wordDelay: number;
    holdDelay: number;
    highlight?: HighlightConfig[];
    insertHTML?: InsertHtmlConfig[]; 
}

export type HighlightTarget = 'question' | 'additional' | 'segment' | 'all';

export interface HighlightConfig {
    targets: HighlightTarget[];
    phrases: string[];
}

export interface InsertHtmlConfig {
    target: 'question' | 'additional' | 'segment';
    targetId: string;
    html: string;
    position: 'append' | 'prepend' | 'replace';
}


export interface TimelineEvent {
    type: 'text' | 'highlight' | 'insert';
    start: number;
    end: number;
    segmentIndex: number;
    content?: HighlightConfig[] | InsertHtmlConfig[];
}

export interface SegmentRef extends WalkthroughConfigs {
    words: string[];
    startTime: number;
    endTime: number;
}