package com.betriebsratkanzlei.legalconsenthub.application_form_version

import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.stereotype.Repository
import java.util.Optional
import java.util.UUID

@Repository
interface ApplicationFormVersionRepository : JpaRepository<ApplicationFormVersion, UUID> {
    fun findByApplicationFormIdOrderByVersionNumberDesc(applicationFormId: UUID): List<ApplicationFormVersion>

    fun findByApplicationFormIdAndVersionNumber(
        applicationFormId: UUID,
        versionNumber: Int,
    ): Optional<ApplicationFormVersion>

    fun countByApplicationFormId(applicationFormId: UUID): Int
}

