import { TElement } from '@udecode/plate-common';

export const ELEMENT_ATTACHMENT = 'attachment';

export interface TAttachmentElement extends TElement {
  type:
    | 'attachment'
    | 'attachment_audio'
    | 'attachment_document'
    | 'attachment_image'
    | 'attachment_video'
    | string;
  url: string;
  name: string;
  size: number;
  fileUrl: string;
  fileType: string;
  width?: string | number;
  height?: string | number;
  align?: 'left' | 'center' | 'right';
  status?: 'link' | 'thumbnail';
  bordered?: boolean;
  uploadStatus: 'uploading' | 'success' | 'fail';
}

export interface AttachmentPlugin {
  uploadAttachment?: (file: File) => Promise<Partial<TAttachmentElement>>;
}
