import { Row } from "antd";
import { twMerge } from "tailwind-merge";
import { useCrushSummary } from "../api/filters.js";
import { isNil } from "../../utils.js";

export const AccidentSimulationModal = ({id, modalOpen, setModalOpen}) => {


  const {data, isLoading} = useCrushSummary(id);

  return (
    <div className="flex flex-col gap-1">
      <Row className={twMerge("font-bold")}>
        In the failure area there are:
      </Row>
      {!isNil(data?.potreb_count) && !isNil(data?.potreb_soc_count) && (
        <Row>
          {data?.potreb_count + data?.potreb_soc_count} consumers (of which {data?.potreb_soc_count} are social facilities)
        </Row>
      )}
      {!isNil(data?.total_area) && (
        <Row>
          Total consumer area - {Math.ceil(data?.total_area)} sq. meters
        </Row>
      )}
      {!isNil(data?.number_of_apartments) && (
        <Row>
          {data?.number_of_apartments} apartments
        </Row>
      )}
      {!isNil(data?.data_min_cooling_time) && !isNil(data?.min_cooling_time) && (
        <Row>
          The fastest cooling building is at
          address {data?.data_min_cooling_time.building_address} ({data?.min_cooling_time} hours)
        </Row>
      )}



    </div>
  );
};
