import {
    useLayoutEffect,
    useState
} from "react";
import {
    View
} from "react-native";
import stylesheet from "./stylesheet";
import {
    NCoreUIKitLocalize,
    PageContainer,
    TimeSelector,
    Header,
    Text
} from "ncore-ui-kit";
import {
    useNavigation
} from "@react-navigation/native";
import type RootStackParamList from "../../../navigation/type";
import type {
    NativeStackNavigationProp
} from "@react-navigation/native-stack";

const TimeSelectorPage = () => {
    const {
        localize
    } = NCoreUIKitLocalize.useContext();

    const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();

    const [
        ,
        setIsSheetContentReady
    ] = useState<boolean>(false);

    useLayoutEffect(() => {
        navigation.setOptions({
            header: () => <Header
                title={localize("components-timeSelector")}
                isWrapSafeareaContext={false}
                navigation={navigation}
                isGoBackEnable={true}
            />,
            headerShown: true
        });
    }, []);

    return <PageContainer
        scrollViewProps={{
            contentContainerStyle: stylesheet.scrollContent
        }}
        scrollViewStyle={[
            stylesheet.container
        ]}
        isWorkWithHeaderSpace={false}
        isScrollable={true}
    >
        <View
            style={[
                stylesheet.contentContainer
            ]}
        >
            <Text
                variant="bodyMediumSize"
                color="mid"
                style={stylesheet.descText}
            >
                {localize("timeSelector-desc")}
            </Text>
            <Text
                style={stylesheet.title}
                variant="titleMediumSize"
            >
                {localize("components-timeSelector")}
            </Text>

            <TimeSelector
                setIsSheetContentReady={setIsSheetContentReady}
                selectMultipleObject={() => {}}
                selectObject={() => {}}
                pickerType="time"
                variant="single"
            />
        </View>
    </PageContainer>;
};
export default TimeSelectorPage;
