package com.ffii.fpsms.modules.stock.entity

import com.ffii.core.support.AbstractRepository
import com.ffii.fpsms.modules.master.entity.Items
import com.ffii.fpsms.modules.stock.entity.projection.InventoryInfo
import org.springframework.data.domain.Page
import org.springframework.data.domain.Pageable
import org.springframework.stereotype.Repository
import java.io.Serializable
import java.util.Optional

@Repository
interface InventoryRepository: AbstractRepository<Inventory, Long> {
    fun findInventoryInfoByDeletedIsFalse(): List<InventoryInfo>

    fun findInventoryInfoByItemCodeContainsAndItemNameContainsAndItemTypeContainsAndDeletedIsFalse(code: String, name: String, type: String, pageable: Pageable): Page<InventoryInfo>

    fun findInventoryInfoByItemIdInAndDeletedIsFalse(itemIds: List<Serializable>): List<InventoryInfo>

    fun findInventoryInfoByItemInAndDeletedIsFalse(items: List<Items>): List<InventoryInfo>

    fun findByItemId(itemId: Long): Optional<Inventory>
}