import SectionSearchFile from '@/app/ui/search/section-search-file';
import { SupportedFormats } from '@/app/ui/search/supported-formats';
import { SearchStats } from '@/app/ui/search/search-stats';
import { RecentSearches } from '@/app/ui/search/recent-searches';
import { getAllowedFilesExtensions } from '@/app/actions/fileUpload';

export default async function Page() {
	const { file_extension: extensionVideo, max_file_size } = await getAllowedFilesExtensions('video');
	const { file_extension: extensionAudio } = await getAllowedFilesExtensions('audio');
	const { file_extension: extensionImage } = await getAllowedFilesExtensions('image');
	const { file_extension: extensionDocument } = await getAllowedFilesExtensions('document');

	return (
		<>
			<div className="block-wrapper">
				<h1 className="page-title">
					Поиск защищенного контента
				</h1>
				<p className="page-description">
					Загрузите файл для поиска похожего защищенного контента в вашей библиотеке и в интернете
				</p>
			</div>
			<div className="search-grid">
				<SectionSearchFile
					maxFileSize={max_file_size}
					/* allowedExtensions={allExtensions} */
					allowedExtensions={{
						images: extensionImage,
						videos: extensionVideo,
						audios: extensionAudio,
						documents: extensionDocument
					}}
				/>
				<div className="search-sidebar">
					<SupportedFormats
						extensionVideo={extensionVideo}
						extensionAudio={extensionAudio}
						extensionImage={extensionImage}
						extensionDocument={extensionDocument}
					/>
					<SearchStats />
					<RecentSearches />
				</div>
			</div>
		</>

	)
}