import ClinicPage from "@/components/clinic";
import Layout from "@/components/layout/StLayout";
import { fetchReq } from "@/lib/req";

async function Clinic({ params: { slug } }) {
  const reqClinics = await fetchReq(
    `https://back-dev.clinic-pro.ir/api/v1/clinic/${slug}`
  );

  const reqDoctors = await fetchReq(
    "https://back-dev.clinic-pro.ir/api/v1/doctors"
  );

  const clinic = reqClinics;
  const doctors = reqDoctors?.data || [];

  return (
    <Layout>
      <ClinicPage data={clinic} doctors={doctors} />
    </Layout>
  );
}

export default Clinic;
