// ./types/editor.min.d.ts
import { ClassicEditor } from '@ckeditor/ckeditor5-editor-classic';
import type Plugin from '@ckeditor/ckeditor5-core/src/plugin';
import { EditorWatchdog } from '@ckeditor/ckeditor5-watchdog';
import '@ckeditor/ckeditor5-core'; 

declare global {
	interface Window {
		Editor: typeof ClassicEditor & {
			builtinPlugins: Array<typeof Plugin>;
			defaultConfig: Record<string, unknown>;
			EditorWatchdog: typeof EditorWatchdog;
		};
	}

	type UploadedImage = {
		src: string;
		name: string;
		size: number;
		extension: string;
		type: string;
		image: File;
	};
	
	type UploadedMedia = {
		url: string;
	};
	
	type UploadedFile = {
		uuid: string;
		name: string;
		size: number;
		extension: string;
		file: File;
	};
}

declare module 'ckeditor5' {
	interface Editor
	{
		// 이미지 정보
		_imageStore?: UploadedImage[];

		// 동영상(iframe, video, oembed) 정보
		_mediaStore?: UploadedMedia[];

		// 첨부 파일 정보
		_fileStore?: UploadedFile[];
	}

	interface EditorConfig {
		maxWordCount?: number;

		// 이미지 설정
		allowImage?: boolean;
		imageUploadLimit?: number;
		imageUploadMaxSize?: number;

		// 동영상 설정
		allowMedia?: boolean;
		mediaUploadLimit?: number;

		// 파일 첨부 설정
		allowFile?: boolean;
		fileUploadLimit?: number;
		fileUploadMaxSize?: number;
		fileUploadExtension?: string[];
	}
}

export {};