/**
 * Sheets Type Definitions
 * Matches univer-sheets-schema.json
 */
export interface IWorkbookData {
    id: string;
    name: string;
    locale?: string;
    sheetOrder: string[];
    sheets: Record<string, IWorksheetData>;
    styles?: Record<string, IStyleData>;
    resources?: Array<{
        name: string;
        data: string;
    }>;
}
export interface IWorksheetData {
    id: string;
    name: string;
    tabColor?: string;
    hidden?: 0 | 1;
    rowCount: number;
    columnCount: number;
    defaultColumnWidth?: number;
    defaultRowHeight?: number;
    showGridlines?: 0 | 1;
    freeze?: IFreeze;
    cellData: ICellDataMatrix;
    rowData?: Record<number, IRowData>;
    columnData?: Record<number, IColumnData>;
    mergeData?: IMergeRange[];
    dataValidations?: IDataValidationRule[];
    conditionalFormattingRules?: IConditionalFormattingRule[];
    autoFilter?: IAutoFilter;
}
export type ICellDataMatrix = Record<number, Record<number, ICellData>>;
export interface ICellData {
    v?: string | number | boolean;
    t?: 1 | 2 | 3 | 4;
    f?: string;
    s?: string | IStyleData;
    p?: IRichTextData;
    custom?: Record<string, unknown>;
}
export interface IRichTextData {
    body: {
        dataStream: string;
        textRuns?: Array<{
            st: number;
            ed: number;
            ts: ITextStyle;
        }>;
    };
}
export interface ITextStyle {
    bl?: 0 | 1;
    it?: 0 | 1;
    ul?: {
        s: number;
    };
    st?: {
        s: number;
    };
    fs?: number;
    ff?: string;
    cl?: IColorStyle;
}
export interface IStyleData {
    ff?: string;
    fs?: number;
    bl?: 0 | 1;
    it?: 0 | 1;
    ul?: {
        s: number;
    };
    st?: {
        s: number;
    };
    cl?: IColorStyle;
    bg?: IColorStyle;
    ht?: 1 | 2 | 3;
    vt?: 1 | 2 | 3;
    tb?: 1 | 2 | 3;
    tr?: {
        a?: number;
        v?: 0 | 1;
    };
    pd?: {
        t?: number;
        b?: number;
        l?: number;
        r?: number;
    };
    bd?: IBorderData;
    n?: {
        pattern: string;
    };
}
export interface IColorStyle {
    rgb?: string;
    th?: string;
}
export interface IBorderData {
    t?: IBorderStyle;
    b?: IBorderStyle;
    l?: IBorderStyle;
    r?: IBorderStyle;
}
export interface IBorderStyle {
    s: number;
    cl: IColorStyle;
}
export interface IRowData {
    h?: number;
    hd?: 0 | 1;
    ia?: 0 | 1;
}
export interface IColumnData {
    w?: number;
    hd?: 0 | 1;
}
export interface IFreeze {
    xSplit: number;
    ySplit: number;
    startRow: number;
    startColumn: number;
}
export interface IMergeRange {
    startRow: number;
    startColumn: number;
    endRow: number;
    endColumn: number;
}
export interface IDataValidationRule {
    uid: string;
    type: 'list' | 'listMultiple' | 'checkbox' | 'custom' | 'decimal' | 'whole' | 'date' | 'textLength';
    ranges: IMergeRange[];
    formula1?: string;
    formula2?: string;
    operator?: string;
    allowBlank?: boolean;
    showErrorMessage?: boolean;
    errorStyle?: 'stop' | 'warning' | 'information';
    errorTitle?: string;
    error?: string;
    showInputMessage?: boolean;
    promptTitle?: string;
    prompt?: string;
}
export interface IConditionalFormattingRule {
    cfId: string;
    ranges: IMergeRange[];
    stopIfTrue?: boolean;
    rule: {
        type: string;
        subType?: string;
        operator?: string;
        value?: unknown;
        value2?: unknown;
        formula?: string;
        style?: IStyleData;
    };
}
export interface IFilterColumn {
    colId: number;
    filters?: {
        filters?: string[];
        blank?: boolean;
    };
}
export interface IAutoFilter {
    ref: IMergeRange;
    filterColumns?: IFilterColumn[];
}
export interface AIWorkbookOutput {
    title: string;
    description: string;
    assumptions: string[] | null;
    warnings: string[] | null;
    workbook: AIWorkbookData;
    workbookData?: AIWorkbookData;
}
export interface AIWorkbookData {
    id: string;
    name: string;
    appVersion?: string | null;
    locale?: string | null;
    sheetOrder: string[];
    sheets: AISheetEntry[];
    styles?: AIStyleEntry[] | null;
    watermark?: IWatermark | null;
}
export interface AISheetEntry {
    id: string;
    sheet: AIWorksheetData;
}
export interface AIStyleEntry {
    id: string;
    style: IStyleData;
}
export interface AIWorksheetData {
    id: string;
    name: string;
    tabColor?: string | null;
    hidden?: 0 | 1 | null;
    rowCount: number;
    columnCount: number;
    defaultColumnWidth?: number | null;
    defaultRowHeight?: number | null;
    showGridlines?: 0 | 1 | null;
    rightToLeft?: 0 | 1 | null;
    freeze?: IFreeze | null;
    cellData: (ICellData | null)[][];
    rowData?: AIRowData[] | null;
    columnData?: AIColumnData[] | null;
    rowHeader?: {
        width?: number | null;
        hidden?: 0 | 1 | null;
    } | null;
    columnHeader?: {
        height?: number | null;
        hidden?: 0 | 1 | null;
    } | null;
    mergeData?: IMergeRange[] | null;
    dataValidations?: IDataValidationRule[] | null;
    conditionalFormattingRules?: IConditionalFormattingRule[] | null;
    autoFilter?: IAutoFilter | null;
    comments?: IThreadComment[] | null;
}
export interface AIRowData {
    row: number;
    h?: number | null;
    hd?: 0 | 1 | null;
}
export interface AIColumnData {
    col: number;
    w?: number | null;
    hd?: 0 | 1 | null;
}
export interface IWatermark {
    type: 'text' | 'image';
    text?: string | null;
    imageUrl?: string | null;
    fontSize?: number | null;
    color?: string | null;
    opacity?: number | null;
    rotate?: number | null;
    repeat?: boolean | null;
}
export interface IThreadComment {
    id: string;
    ref: string;
    dT?: string | null;
    personId?: string | null;
    text: {
        dataStream: string;
    };
    resolved?: boolean | null;
}
