import Card from "../../../ui/Card";
import { Tab, Tabs, TabList, TabPanel } from "react-tabs";
import "react-tabs/style/react-tabs.css";
import RegionSelector from "./RegionSelector";
import type { Region } from "../../../types/types";

type CameraSettingsProps = {
  regions: Region[];
  selectedRegionIndex: number;
  onSelectRegion: (index: number) => void;
  onChangeRegionColour: (index: number, colour: string) => void;
  isErasing: boolean;
  onSelectErasing: (isErasing: boolean) => void;
};

const CameraSettings = ({
  regions,
  selectedRegionIndex,
  onSelectRegion,
  onChangeRegionColour,
  isErasing,
  onSelectErasing,
}: CameraSettingsProps) => {
  return (
    <Card className="p-4 min-h-screen w-[80%] place-self-end">
      <Tabs selectedTabClassName="bg-gray-300 text-gray-900 font-semibold border-none rounded-sm">
        <TabList>
          <Tab>Target Detection</Tab>
          <Tab>Camera 1</Tab>
        </TabList>
        <TabPanel>
          <RegionSelector
            regions={regions}
            selectedRegionIndex={selectedRegionIndex}
            onSelectRegion={onSelectRegion}
            onChangeRegionColour={onChangeRegionColour}
            isErasing={isErasing}
            onSelectErasing={onSelectErasing}
          />
        </TabPanel>
        <TabPanel>
          <div>Camera details</div>
        </TabPanel>
      </Tabs>
    </Card>
  );
};

export default CameraSettings;
