import { getServerApi } from '@garage/api/server'
import { EstimateGeneralInfo } from '@/modules/estimates/estimate-general-info'
import DashboardPage from '@/base/components/layout/dashboard/dashboard-page'

export default async function page(props: { params: Promise<{ id: string }> }) {
    const { id } = await props.params
    const api = await getServerApi()
    const estimate = await api.estimates.getById(id)

    const estimateData = (estimate as any)?.data

    if (!estimateData) {
        return <div className="text-muted-foreground p-4">Estimate not found.</div>
    }

    return (
        <DashboardPage header={null}>
            <EstimateGeneralInfo estimate={estimateData} />
        </DashboardPage>
    )
}
