package dev.fyloz.trial.colorrecipesexplorer.service

import dev.fyloz.trial.colorrecipesexplorer.model.Material
import dev.fyloz.trial.colorrecipesexplorer.model.MixMaterial
import dev.fyloz.trial.colorrecipesexplorer.repository.MixMaterialRepository
import org.springframework.stereotype.Service

interface MixMaterialService : ModelService<MixMaterial, MixMaterialRepository> {
    /** Checks if one or more mix materials have the given [material]. */
    fun existsByMaterial(material: Material): Boolean
}

@Service
class MixMaterialServiceImpl(mixMaterialRepository: MixMaterialRepository) :
    AbstractModelService<MixMaterial, MixMaterialRepository>(mixMaterialRepository), MixMaterialService {
    override fun existsByMaterial(material: Material): Boolean = repository.existsByMaterial(material)
}
