import { DocumentLayout, LayoutAsyncData, LayoutSection, LayoutSectionType, Uuid } from "@win2win/shared";

export interface SectionData {
    global: LayoutAsyncData[],
    section: LayoutAsyncData[]
}

export const layoutSectionLabels = {
    [LayoutSectionType.TEXT]: 'Texto',
    [LayoutSectionType.TABLE]: 'Tabla',
    [LayoutSectionType.CARDS_GRID]: 'Tarjetas',
    [LayoutSectionType.IMAGE]: 'Imagen',
    [LayoutSectionType.SIGNATURE]: 'Firma',
    [LayoutSectionType.RADIO_BUTTONS]: 'Botones de opción (radio buttons)'
}

export interface DocumentLayoutRaw {
    ID_DOCUMENT_LAYOUT: Uuid;
    CONTEXT: string;
    NAME: string;
    DESCRIPTION: string;
    FORMAT: any;
    ASYNC_DATA: any[];
    STYLES: any;
    CREATED_AT: Date;
    UPDATED_AT: Date;
    SECTIONS: DocumentLayoutSectionRaw[];
}

export type DocumentLayoutRawLite = Omit<DocumentLayoutRaw, 'SECTIONS' | 'FORMAT' | 'DESCRIPTION' | 'ASYNC_DATA' | 'STYLES'> & {
    SECTIONS: { ID_DOC_LAY_SECTION: Uuid }[]
}

export interface DocumentLayoutSectionRaw {
    ID_DOC_LAY_SECTION: string;
    ID_DOCUMENT_LAYOUT: string;
    TYPE: string;
    ASYNC_DATA: any[];
    STYLES: {
        margins: number[];
        background: string;
        typography: string;
    };
    CONTENT: any;
    CREATED_AT: Date;
    UPDATED_AT: Date;
}


export type DocumentLayoutModel = Omit<DocumentLayout, 'sections'> & { sections: LayoutSectionModel[] }
export type LayoutSectionModel = LayoutSection & { id: string }