package com.dowstats.data.repositories

import com.dowstats.data.entities.Mod
import org.springframework.data.jpa.repository.Modifying
import org.springframework.data.jpa.repository.Query
import org.springframework.data.repository.*

interface ModRepository : CrudRepository<Mod, Long>{
    fun findByTechnicalNameAndVersion(techName: String, version: String): Mod?

    @Query("""
        CALL delete_mod_data(:modId)
    """, nativeQuery = true)
    @Modifying
    fun clearModData(modId: Long)

    @Query("""
        CALL delete_campaign_entities(:modId)
    """, nativeQuery = true)
    @Modifying
    fun removeCampaignEntities(modId: Long)
}