package dev.fyloz.trial.colorrecipesexplorer.model

/** The model of a stored entity. Each model should implements its own equals and hashCode methods to keep compatibility with the legacy Java and Thymeleaf code. */
interface Model {
    val id: Long?
}

interface NamedModel : Model {
    val name: String
}

interface EntityDto<out E> {
    /** Converts the dto to an actual entity. */
    fun toEntity(): E
}

fun Collection<Model>.sortedById(): Collection<Model> = this.sortedBy { it.id }
