import { getServerApi } from '@garage/api/server'
import { JobCardGeneralInfo } from '@/modules/job-cards/job-card-general-info'
import DashboardPage from '@/base/components/layout/dashboard/dashboard-page'
import type { JobCardShowData } from '@garage/api'

export default async function JobCardDetailPage(props: { params: Promise<{ id: string }> }) {
    const { id } = await props.params
    const api = await getServerApi()
    const response = await api.jobCards.show(id)
    const data = response.data

    if (!data) {
        return <div className="text-muted-foreground">Job card not found.</div>
    }

    return (
        <DashboardPage header={null}>
            <JobCardGeneralInfo jobCard={data} />
        </DashboardPage>
    )
}
