import { ReportType } from "@/contracts/client.schemas";

import { BaseReportBuilder } from "../BaseReportBuilder";
import { ByStateReportBuilder } from "../by-state/ByStateReportBuilder";
import { JournalReportBuilder } from "../journal/JournalReportBuilder";
import { SummaryEventsReportBuilder } from "../summary-events/SummaryEventsReportBuilder";

export const useBuilderFactory = () => {
	return {
		create: (type: ReportType): BaseReportBuilder => {
			switch (type) {
				case ReportType.ByState:
					return new ByStateReportBuilder();
				case ReportType.Journal:
					return new JournalReportBuilder();
				case ReportType.SummaryEvents:
					return new SummaryEventsReportBuilder();
				default:
					throw new Error("Unknown report type");
			}
		},
	};
};
