// Enum values copied from the backend (Drizzle + Python)
import { z } from "zod";

export const REPORT_TYPES = [
  //   "quidos_presite_note",
  //   "charted_surveyor_report",
  //   "u_value_calculator_report",
  //   "overwriting_u_value_declaration_form",
  "osmosis_condition_pas_2035_report",
  //   "warm_homes_condition_pas_2035_report",
  //   "energy_performance_report_with_data",
  "energy_performance_report_summary_information",
  "lodgement_xml_needed_for_lodgement_to_like_trademark",
  "reduce_xml_needed_to_generate_full_sap_xml",
  "full_xml_needed_for_co_ordination",
  "decent_homes_summary",
  "decent_homes_property_meta",
  //   "decent_homes_energy_performance_report",
  //   "decent_homes_energy_performance_report_summary_information",
  //   "floor_plan",
  //   "occupancy_assessment",
] as const;

export type ReportType = (typeof REPORT_TYPES)[number];

// Map reportType → title for UI
export const documentTypeTitles: Record<ReportType, string> = {
  //   quidos_presite_note: "RdSAP Summary Report",
  //   charted_surveyor_report: "Chartered Surveyor Report",
  //   u_value_calculator_report: "U-Value Calculator Report",
  //   overwriting_u_value_declaration_form: "Overwriting U-Value Declaration Form",
  osmosis_condition_pas_2035_report: "Osmosis Condition Report (PAS 2035)",
  //   warm_homes_condition_pas_2035_report: "Warm Homes PAS 2035 Report",
  //   energy_performance_report_with_data: "EPC Report With Data",
  energy_performance_report_summary_information: "EPC Summary Report",
  lodgement_xml_needed_for_lodgement_to_like_trademark: "LIG XML",
  reduce_xml_needed_to_generate_full_sap_xml: "RdSAP XML",
  full_xml_needed_for_co_ordination: "Full SAP XML",
  decent_homes_summary: "Decent Homes Summary",
  decent_homes_property_meta: "Decent Homes Property Meta",
  //   decent_homes_energy_performance_report: "Decent Homes Energy Performance Report",
  //   decent_homes_energy_performance_report_summary_information:
  //     "Decent Homes Energy Performance Report Summary Information",
  //   floor_plan: "Floor Plan",
  //   occupancy_assessment: "Occupancy Assessment",
};

// Map reportType → accepted file extensions
export const documentTypeFileTypes: Record<
  ReportType,
  ".pdf" | ".xml" | ".xml,.pdf" | ".json"
> = {
  //   quidos_presite_note: ".pdf",
  //   charted_surveyor_report: ".pdf",
  //   u_value_calculator_report: ".pdf",
  //   overwriting_u_value_declaration_form: ".pdf",
  osmosis_condition_pas_2035_report: ".pdf",
  //   warm_homes_condition_pas_2035_report: ".pdf",
  //   energy_performance_report_with_data: ".pdf",
  energy_performance_report_summary_information: ".pdf",
  lodgement_xml_needed_for_lodgement_to_like_trademark: ".xml",
  reduce_xml_needed_to_generate_full_sap_xml: ".xml",
  full_xml_needed_for_co_ordination: ".xml",
  decent_homes_property_meta: ".json",
  decent_homes_summary: ".json",
  //   floor_plan: ".pdf",
  //   occupancy_assessment: ".pdf",
};
export const ReportTypeSchema = z.enum(REPORT_TYPES);

// Map UI value -> DB enum NAME
export const reportTypeToDbLabel: Record<ReportType, string> = {
  osmosis_condition_pas_2035_report: "ECO_CONDITION_REPORT",
  energy_performance_report_summary_information:
    "ENERGY_PERFORMANCE_REPORT_SUMMARY_INFORMATION",
  lodgement_xml_needed_for_lodgement_to_like_trademark: "LIG_XML",
  reduce_xml_needed_to_generate_full_sap_xml: "RDSAP_XML",
  full_xml_needed_for_co_ordination: "FULLSAP_XML",
  decent_homes_summary: "DECENT_HOMES_SUMMARY",
  decent_homes_property_meta: "DECENT_HOMES_PROPERTY_META",
};

// Optional reverse map (for reading from API):
export const dbLabelToReportType: Record<string, ReportType> = {
  ECO_CONDITION_REPORT: "osmosis_condition_pas_2035_report",
  ENERGY_PERFORMANCE_REPORT_SUMMARY_INFORMATION:
    "energy_performance_report_summary_information",
  LIG_XML: "lodgement_xml_needed_for_lodgement_to_like_trademark",
  RDSAP_XML: "reduce_xml_needed_to_generate_full_sap_xml",
  FULLSAP_XML: "full_xml_needed_for_co_ordination",
  DECENT_HOMES_SUMMARY: "decent_homes_summary",
  DECENT_HOMES_PROPERTY_META: "decent_homes_property_meta",
};
