"use client";

import { useState } from "react";
import List from "./List";
import Head from "./head";

function Doctors({ slug, doctors, pages }) {
  const [page, setPage] = useState(pages?.current || 1);

  const [totalPage, setTotalPage] = useState(pages?.total_pages||1);

  const [filter, setFilter] = useState({});
  const [filteredSpecialties, setFilteredSpecialties] = useState(doctors);

  return (
    <div className="opacity-page">
      <Head
        setDoctors={setFilteredSpecialties}
        slug={slug}
        filter={filter}
        setFilter={setFilter}
        setPage={setPage}
        setTotalPage={setTotalPage}
      />
      <List
        slug={slug}
        totalPages={totalPage}
        filter={filter}
        doctors={filteredSpecialties}
        setDoctors={setFilteredSpecialties}
        page={page}
        limit={50}
        setPage={setPage}
        setTotalPage={setTotalPage}
      />
    </div>
  );
}

export default Doctors;
