package de.trainingstagebuch.app.services

import de.trainingstagebuch.app.repository.PredefinedActivitiesResult
import de.trainingstagebuch.app.repository.PredefinedActivityActionResult
import de.trainingstagebuch.app.repository.PredefinedActivityDetailResult
import de.trainingstagebuch.app.repository.PredefinedActivityInput
import de.trainingstagebuch.app.repository.TrainingstagebuchRepository

class PredefinedActivitiesService(
    private val repository: TrainingstagebuchRepository
) {
    suspend fun loadAll(): PredefinedActivitiesResult = repository.loadPredefinedActivities()

    suspend fun loadOne(activityId: String): PredefinedActivityDetailResult =
        repository.loadPredefinedActivity(activityId)

    suspend fun search(query: String, limit: Int = 50): PredefinedActivitiesResult =
        repository.searchPredefinedActivities(query, limit)

    suspend fun create(input: PredefinedActivityInput): PredefinedActivityDetailResult =
        repository.createPredefinedActivity(input)

    suspend fun update(activityId: String, input: PredefinedActivityInput): PredefinedActivityDetailResult =
        repository.updatePredefinedActivity(activityId, input)

    suspend fun merge(sourceId: String, targetId: String): PredefinedActivityActionResult =
        repository.mergePredefinedActivities(sourceId, targetId)

    suspend fun deduplicate(): PredefinedActivityActionResult =
        repository.deduplicatePredefinedActivities()

    suspend fun deleteImage(activityId: String, imageId: String): PredefinedActivityActionResult =
        repository.deletePredefinedActivityImage(activityId, imageId)
}

