import { Button, ButtonGroup, TextField } from "@mui/material";
import SearchD from "@/components/icons/SearchD";
import ModalSearchCity from "@/app/component/modalSearchCity";
import { useState } from "react";
import ButtonFilter from "@/app/component/modalSearchCity/ButtonFilter";
import AutoCompleteSearch from "@/components/searchHead/smSearch/AutoCompleteSearch";

function SearchBar({
  selected,
  setSelected,
  specialties,
  state,
  handleSearch,
}) {
  const [open, setOpen] = useState(false);

  return (
    <ButtonGroup
      variant="contained"
      className="
            !bg-[#FFF] !w-full sm:!w-2/3 !mt-[30px] !rounded-lg !overflow-hidden flex items-center 
            !shadow-[0px_1px_24.8px_0px_rgba(204,_204,_204,_0.18)]
            !h-fit !pl-1"
    >
      <ModalSearchCity
        open={open}
        state={state}
        setOpen={setOpen}
        selected={selected}
        setSelected={setSelected}
        handleSearch={handleSearch}
      >
        <ButtonFilter setOpen={setOpen} selected={selected} />
      </ModalSearchCity>
      <AutoCompleteSearch
        data={specialties}
        placeholder="جستجوی تخصص"
        handleSearch={handleSearch}
      />
      {/* <TextField
        variant="standard"
        onChange={(e) => handleSearch(e.target.value)}
        InputProps={{
          disableUnderline: true,
        }}
        sx={{
          background: "transparent !important",
          "& .MuiInputBase-input": { color: "#7E7E7E" },
          "& .MuiInput-root": { borderBottom: "none" },
          "& .MuiInputBase-root": { height: "100%" },
        }}
        placeholder="جستجوی تخصص"
        dir="rtl"
        className={`!shadow-none !w-full !min-w-3 !px-5 !h-full bg-[#FAFAFA] !text-[14px] md:!text-[16px] lg:!min-w-[50%] !rounded-0 !font-normal !text-[#6C757D]`}
      /> */}
      <Button
        onClick={handleSearch}
        className="
          !rounded-[4px] !gap-2.5 !p-2 md:!p-3 lg:!p-4
          !w-[38px] sm:!w-[44px] md:!w-[50px] lg:!w-[56px] 
          !h-[38px] sm:!h-[44px] md:!h-[50px] lg:!h-[56px] 
          !min-w-[38px] sm:!min-w-[44px] md:!min-w-[50px] lg:!min-w-[56px] 
          !min-h-[38px] sm:!min-h-[44px] md:!min-h-[50px] lg:!min-h-[56px] 
          !max-w-[38px] sm:!max-w-[44px] md:!max-w-[50px] lg:!max-w-[56px] 
          !max-h-[38px] sm:!max-h-[44px] md:!max-h-[50px] lg:!max-h-[56px] 
        "
      >
        <SearchD />
      </Button>
    </ButtonGroup>
  );
}

export default SearchBar;
