import { ToolShapeMap, JsonShape } from '@procore/markup-viewer';
import { ActiveAttributes, ViewerState } from '@src/redux/markupViewer/markupViewertypes';
import { UIState } from '@src/redux/ui/UIReducer';
import { UndoRedoState } from '@src/redux/undoRedo/undoRedoReducer';
import { ExternalMarkupType } from '../markupTools/ToolTypeEnums';
import { NormalizedByID, NormalizedByUUID } from './reduxUtitlityTypes';
import { BIMDocumentTypes, BIMDocumentConfig } from '../pageRenderers/ModelTypes';
export declare enum ContentFamily {
    Audio = "audio",
    Image = "image",
    Pdf = "pdf",
    PowerPoint = "powerpoint",
    Unsupported = "unsupported",
    WordDocument = "word_document",
    Spreadsheet = "spreadsheet",
    Cad = "cad",
    Video = "video",
    Model = "model"
}
export declare type RequiredUrl = string;
export declare type OptionalUrl = RequiredUrl | undefined;
interface OutdatedDocumentKeys {
    has_markup?: boolean;
}
export interface ServerDocumentBase extends OutdatedDocumentKeys {
    basename: string;
    extension: string;
    name: string;
    id: number | string;
    size: number | null;
    created_at: string;
    updated_at: string;
    content_family: ContentFamily;
    pages?: ViewableDocumentPage[];
    original_filename?: string;
    url?: OptionalUrl;
    bimConfig?: BIMDocumentConfig<BIMDocumentTypes>;
}
export interface ServerDocumentPDF extends ServerDocumentBase {
    url: OptionalUrl;
}
export interface ServerDocumentBIM<Type extends keyof typeof BIMDocumentTypes> extends ServerDocumentBase {
    bimConfig: BIMDocumentConfig<Type>;
}
export declare type SDKSetDocumentFn = <C extends ContentFamily | void = void, M extends C extends ContentFamily.Model ? keyof typeof BIMDocumentTypes : never = never>(document: C extends ContentFamily.Model ? ServerDocumentBIM<M> : C extends ContentFamily.Pdf ? ServerDocumentPDF : ServerDocumentBase) => void;
export declare type ServerDocument = ServerDocumentBase | ServerDocumentPDF | ServerDocumentBIM<BIMDocumentTypes>;
export declare enum PrepareDownloadStatuses {
    Processing = "processing",
    Completed = "completed",
    Error = "error"
}
interface PrepareDownloadDataBase {
    id: string;
    error_message?: string;
    pusher_message_name?: string;
    status?: PrepareDownloadStatuses;
    url?: string | null;
}
export interface PrepareDownloadDataCompleted extends PrepareDownloadDataBase {
    status: PrepareDownloadStatuses.Completed;
    url: string;
    error_message: undefined;
    pusher_message_name: undefined;
}
export interface PrepareDownloadDataProcessing extends PrepareDownloadDataBase {
    status: PrepareDownloadStatuses.Processing;
    pusher_message_name: string;
    url?: null;
    error_message: undefined;
}
export interface PrepareDownloadDataError extends PrepareDownloadDataBase {
    status: PrepareDownloadStatuses.Error;
    error_message: string;
    url?: null;
    pusher_message_name: undefined;
}
export declare type PrepareDownloadData = PrepareDownloadDataCompleted | PrepareDownloadDataProcessing | PrepareDownloadDataError;
export declare type PrepareDownloadHandler = () => Promise<PrepareDownloadData>;
export declare type MarkupElementHandler = (elements: any[]) => Promise<MarkupElement[] | Error>;
export interface EndpointUrls {
    analytics?: {
        create?: OptionalUrl;
    };
    document?: {
        direct_download?: OptionalUrl;
        prepare_download?: OptionalUrl;
        search?: OptionalUrl;
        update?: OptionalUrl;
    };
    document_handlers?: {
        prepare_download?: PrepareDownloadHandler;
    };
    pages?: {
        create?: OptionalUrl;
    };
    markup_elements?: {
        batch_update?: OptionalUrl;
        batch_destroy?: OptionalUrl;
        batch_retrieve?: OptionalUrl;
        create?: OptionalUrl;
        index?: OptionalUrl;
    };
    markup_element_handlers?: {
        batch_update?: MarkupElementHandler;
        batch_destroy?: MarkupElementHandler;
        batch_retrieve?: MarkupElementHandler;
        create?: MarkupElementHandler;
        index?: () => Promise<MarkupElement[]>;
    };
}
export interface NativePdfPageElements {
    canvas: HTMLCanvasElement;
    textLayer: HTMLDivElement;
    annotationLayer: HTMLDivElement;
}
export interface ViewableDocumentPage {
    id: number;
    has_markup: boolean;
    page_number: number;
    urls: {
        page_content: RequiredUrl;
        destroy?: OptionalUrl;
    };
    htmlString?: string;
    htmlElements?: NativePdfPageElements;
    page_type?: 'blank_page';
}
export declare type UniqueUserHash = string;
export interface MarkupElementFilters {
    created_before?: string;
}
export interface ReduxPage extends ViewableDocumentPage {
    markup_urls?: EndpointUrls['markup_elements'];
    fetchedFromServer?: boolean;
    isFetching?: boolean;
    isLoading?: boolean;
}
interface MarkupElementBase {
    id: number | string;
    editable: boolean;
    shape?: JsonShape;
    svg?: string;
    tool_name?: ExternalMarkupType;
    created_at: string;
    created_by_id: number | string;
    created_by_name: string;
    created_by_vendor_name: string;
    updated_at: string;
    type?: ExternalMarkupType;
    document_markup_page_id?: number;
    document_markup_layer_id?: number;
}
interface MarkupElementFromServerBase extends MarkupElementBase {
    document_markup_page_id: number;
    document_markup_layer_id: number;
}
export interface MarkupElementSVGFromServer extends MarkupElementFromServerBase {
    svg: string;
    type: ExternalMarkupType;
}
export interface MarkupElementJSONFromServer extends MarkupElementFromServerBase {
    tool_name: ExternalMarkupType;
    shape: JsonShape;
}
export declare type MarkupElementJSONShape<T extends keyof ToolShapeMap> = MarkupElementJSONFromServer & {
    shape: ToolShapeMap[T];
};
export declare type MarkupElementFromServer = MarkupElementJSONFromServer | MarkupElementSVGFromServer;
export interface ConsumerMarkupElementBase extends MarkupElementBase {
    pageId: number;
    tool_name: ExternalMarkupType;
}
export interface ConsumerMarkupElementSVG extends ConsumerMarkupElementBase {
    svg: string;
    type: ExternalMarkupType;
}
export interface ConsumerMarkupElementJSON extends ConsumerMarkupElementBase {
    shape: JsonShape;
}
export declare type MarkupElement = ConsumerMarkupElementSVG | ConsumerMarkupElementJSON;
interface ReduxMarkupElementBase extends ConsumerMarkupElementBase {
    page_number?: number;
    selectable?: boolean;
    needsRerender: boolean;
    uuid: string;
    attributes: ActiveAttributes;
}
interface ReduxJsonMarkup extends ReduxMarkupElementBase {
    shape: JsonShape;
}
interface ReduxSvgMarkup extends ReduxMarkupElementBase {
    svg: string;
}
export declare type ReduxMarkupElement = ReduxJsonMarkup | ReduxSvgMarkup;
export interface MarkupToolbarsState {
    urls: EndpointUrls;
    undoRedo: {
        markupElements: UndoRedoState<ReduxMarkupElement>;
    };
    entities: {
        pages: NormalizedByID<ReduxPage>;
        markupElements: NormalizedByUUID<ReduxMarkupElement>;
        document: ServerDocument;
    };
    meta: {
        filters: MarkupElementFilters;
    };
    ui: UIState;
    viewer: ViewerState;
}
export declare type ViewerFile = Pick<ServerDocument, 'id' | 'name' | 'original_filename'>;
export {};
