import ProtectionSummary from '@/app/ui/marking-page/protection-summary';
import FilesTable from '@/app/ui/dashboard/files-table';
import PageTitle from '@/app/ui/page-title';
import UploadSectionFile from '@/app/components/upload-section-file';
import { getAllowedFilesExtensions } from '@/app/actions/fileUpload';
import {StackedBarChart} from '@/app/components/StackedBarChart';

const data = [
	{
		name: 'File A',
		checks: 4,
		violations: 2
	},
	{
		name: 'File B',
		checks: 8,
		violations: 4
	},
	{
		name: 'File C',
		checks: 2,
		violations: 1
	},
	{
		name: 'File D',
		checks: 7,
		violations: 1
	},
	{
		name: 'File E',
		checks: 5,
		violations: 4
	},
];

export default async function Page() {
	const FILE_TYPE = "image";
	const { file_extension, max_file_size } = await getAllowedFilesExtensions(FILE_TYPE);

	return (
		<div>
			<PageTitle title="image-protection" />
			<div className="split-blocks">
				<ProtectionSummary />
				<div className="protection-overview">
					<StackedBarChart data={data} />
				</div>
			</div>
			<UploadSectionFile fileType={FILE_TYPE} allowedExtensions={file_extension} maxFileSize={max_file_size} />
			<FilesTable fileType={FILE_TYPE} />
		</div>
	)
}