import React from 'react'
import { useProductStore } from '../store/Store'
import { useSharedStore } from '@/share/store/sharedStore'
import OnlineCart from './OnlineCart'
import OfflineCart from './OfflineCart'

interface CartProps {
    stock: number
}

const Cart = ({ stock }: CartProps) => {
    const { variantId } = useProductStore()
    const { isLogin } = useSharedStore()

    return (
        <div>
            {isLogin ? (
                <OnlineCart variantId={variantId} stock={stock} />
            ) : (
                <OfflineCart variantId={variantId} stock={stock} />
            )}
        </div>
    )
}

export default Cart