import React, { useEffect } from 'react';
import { View } from 'react-native';
import { useLocalSearchParams } from 'expo-router';
import { SlotProducts } from '@/components/SlotSpecificView';
import { useSlotStore } from '@/components/stores/slotStore';
import TabLayoutWrapper from '@/components/TabLayoutWrapper';

export default function SlotView() {
  const params = useLocalSearchParams();
  const { slotId:id, storeId } = useLocalSearchParams();
  const slotId = id ? Number(id) : undefined;
  const setSlotId = useSlotStore(state => state.setSlotId);
  const setStoreId = useSlotStore(state => state.setStoreId);

  useEffect(() => {
    setSlotId(slotId);
    setStoreId(Number(storeId));
  }, [slotId, storeId, setSlotId, setStoreId]);

  return (
    <SlotProducts storeId={Number(storeId)} slotId={slotId} baseUrl="/(drawer)/(tabs)/home/slot-view" />
  );
}