import { t } from "i18next";
import { ReactNode } from "react";

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

import { BaseReportBuilder } from "../BaseReportBuilder";
import { Report } from "../models/Report";

import { JournalProperties } from "./JournalProperties";
import { JournalReportDetails } from "./JournalReportDetails";

export class JournalReportBuilder implements BaseReportBuilder {
	public getTitle(): string | null {
		return t("objectJournal");
	}

	public renderDetails(report: Report): ReactNode | null {
		return <JournalReportDetails report={report} />;
	}

	public getType(): ReportType {
		return ReportType.Journal;
	}

	public getOptions = () => ({
		useExcelExport: false,
		usePdfExport: true,
		name: t("objectJournal"),
	});

	public useDateRange(): boolean {
		return true;
	}

	public renderExtraProperties(): ReactNode | null {
		return <JournalProperties />;
	}
}
