package com.ffii.fpsms.modules.master.entity

import com.ffii.core.support.AbstractRepository
import com.ffii.fpsms.modules.master.entity.projections.PrinterCombo
import org.springframework.data.jpa.repository.Query
import org.springframework.stereotype.Repository
import java.io.Serializable

@Repository
interface PrinterRepository : AbstractRepository<Printer, Long> {
    fun findPrinterComboByDeletedFalse(): List<PrinterCombo>;

    fun findByIdAndDeletedFalse(id: Serializable): Printer?;
    
    fun findAllByDeletedIsFalse(): List<Printer>;
    
    @Query("SELECT DISTINCT p.description FROM Printer p WHERE p.deleted = false AND p.description IS NOT NULL AND p.description != '' ORDER BY p.description")
    fun findDistinctDescriptionsByDeletedIsFalse(): List<String>;
}