import React from "react";
import GeneralLoading from "../General/GeneralLoading";
import { fetchDoDetail } from "@/app/api/do/actions";
import DoDetail from "./DoDetail";

interface SubComponents {
    Loading: typeof GeneralLoading;
}

type DoDetailProps = {
    id?: number;
}

type Props = DoDetailProps

const DoDetailWrapper: React.FC<Props> & SubComponents = async ({
    id,
}) => {
    const doDetail = id ? await fetchDoDetail(id) : undefined

    return <DoDetail id={id} defaultValues={doDetail}/>
}

DoDetailWrapper.Loading = GeneralLoading;

export default DoDetailWrapper;