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

export default function FlashDeliveryProductsLayout() {
  const { storeId: storeIdRaw } = useLocalSearchParams();
  const setStoreId = useSlotStore(state => state.setStoreId);

  useEffect(() => {
    setStoreId(Number(storeIdRaw));
  }, [storeIdRaw, setStoreId]);

  return (
    <TabLayoutWrapper>
      <SlotLayout
        storeId={Number(storeIdRaw)}
        baseUrl="/(drawer)/(tabs)/flash-delivery"
        isForFlashDelivery={true}
      />
    </TabLayoutWrapper>
  );
}