import { CreateItemInputs } from "@/app/api/settings/item/actions";
import { fetchItem } from "@/app/api/settings/item";
import GeneralLoading from "@/components/General/GeneralLoading";
import RoughScheduleDetailView from "@/components/RoughScheduleDetail/RoughScheudleDetailView";
import React from "react";
import { ScheduleType, fetchRoughProdScheduleDetail } from "@/app/api/scheduling";
interface SubComponents {
  Loading: typeof GeneralLoading;
}

type Props = {
  id?: number;
  type: ScheduleType;
};

const RoughScheduleDetailWrapper: React.FC<Props> & SubComponents = async ({
  id,
  type,
}) => {
  const prodSchedule = id ? await fetchRoughProdScheduleDetail(id) : undefined;

  return (
    <RoughScheduleDetailView
      isEditMode={Boolean(id)}
      type={type}
      defaultValues={prodSchedule}
    />
  );
};
RoughScheduleDetailWrapper.Loading = GeneralLoading;

export default RoughScheduleDetailWrapper;
