import express from 'express'
import inventoryController from '../controller/inventoryController.js'
import authMiddleware from '../middleware/authMiddleware.js'

const router = express.Router()

// Create - Add new inventory item
router.post('/add',authMiddleware, inventoryController.addInventory)

// Read - Get all inventory items
router.get('/all', inventoryController.getAllInventory)

// Read - Get inventory by userId
router.get('/user/:userId', inventoryController.getInventoryByUserId)

// Read - Get inventory item by ID
router.get('/:id', inventoryController.getInventoryById)

// Update - Update inventory item
router.put('/:id', inventoryController.updateInventory)

// Update - Update stock (add or remove)
router.patch('/:id/stock', inventoryController.updateStock)

// Delete - Delete inventory item
router.delete('/:id', inventoryController.deleteInventory)

export default router
