'use client'
import {useState} from "react";
import SeriesSettingSidebar from "@/components/series/SeriesSettingSidebar";
import SeriesSettingOption from "@/components/series/SeriesSettingOption";
import {SeriesContext} from "@/context/SeriesContext";
import {useTranslations} from '@/lib/i18n';
import SettingsPanel from "@/components/ui/SettingsPanel";

interface SeriesSettingProps {
    seriesId: string;
    onClose: () => void;
}

export default function SeriesSetting({seriesId, onClose}: SeriesSettingProps) {
    const t = useTranslations();
    const [currentSetting, setCurrentSetting] = useState<string>('basic-information');
    
    return (
        <SeriesContext.Provider value={{seriesId}}>
            <SettingsPanel
                title={t("bookList.seriesSettings")}
                sidebar={
                    <SeriesSettingSidebar
                        selectedSetting={currentSetting}
                        setSelectedSetting={setCurrentSetting}
                        seriesId={seriesId}
                        onClose={onClose}
                    />
                }
                onClose={onClose}
            >
                <SeriesSettingOption setting={currentSetting}/>
            </SettingsPanel>
        </SeriesContext.Provider>
    );
}
