import dayjs from "dayjs";

import { FileType, ReportType } from "@/contracts/client.schemas";
import { useReportTitle } from "@/features/Reports/lib/useReportTitle";
import { getFileExtension } from "@/modules/reports/utils/file";

export function useReportFileName() {
	const { getTitle } = useReportTitle();

	return {
		getFileName: (
			reportType: ReportType,
			fileType: FileType,
			createdAt: Date,
		) =>
			`${getTitle(reportType)} - ${dayjs(createdAt).format("YYYY-MM-DD HH-mm-ss")}${getFileExtension(fileType)}`,
	};
}
