package com.gestoreasy.repository

import com.gestoreasy.database.dao.OrderItemDao
import com.gestoreasy.database.entities.OrderItem

class OrderItemRepository(private val orderItemDao: OrderItemDao) {
    suspend fun insert(item: OrderItem): Long {
        return orderItemDao.insert(item)
    }
    
    suspend fun insertAll(items: List<OrderItem>) {
        orderItemDao.insertAll(items)
    }
    
    suspend fun update(item: OrderItem) {
        orderItemDao.update(item)
    }
    
    suspend fun delete(item: OrderItem) {
        orderItemDao.delete(item)
    }
    
    suspend fun getById(id: Long): OrderItem? {
        return orderItemDao.getById(id)
    }
    
    suspend fun getByOrderId(orderId: Long): List<OrderItem> {
        return orderItemDao.getByOrderId(orderId)
    }
    
    suspend fun getAll(): List<OrderItem> {
        return orderItemDao.getAll()
    }
    
    suspend fun deleteByOrderId(orderId: Long) {
        orderItemDao.deleteByOrderId(orderId)
    }
}

