package de.trainingstagebuch.app.services

import de.trainingstagebuch.app.repository.ClubSettingsActionResult
import de.trainingstagebuch.app.repository.ClubSettingsResult
import de.trainingstagebuch.app.repository.ClubTrainingGroupsResult
import de.trainingstagebuch.app.repository.ClubTrainingTimesResult
import de.trainingstagebuch.app.repository.ClubActionResult
import de.trainingstagebuch.app.repository.TrainingstagebuchRepository

class ClubSettingsService(
    private val repository: TrainingstagebuchRepository
) {
    suspend fun loadClubSettings(clubId: String): ClubSettingsResult {
        return repository.loadClubSettings(clubId)
    }

    suspend fun saveClubSettings(
        clubId: String,
        greetingText: String,
        associationMemberNumber: String
    ): ClubSettingsActionResult {
        return repository.saveClubSettings(
            clubId = clubId,
            greetingText = greetingText,
            associationMemberNumber = associationMemberNumber
        )
    }

    suspend fun loadTrainingGroups(clubId: String): ClubTrainingGroupsResult {
        return repository.loadClubTrainingGroups(clubId)
    }

    suspend fun createTrainingGroup(clubId: String, name: String): ClubActionResult {
        return repository.createClubTrainingGroup(clubId, name)
    }

    suspend fun deleteTrainingGroup(clubId: String, groupId: String): ClubActionResult {
        return repository.deleteClubTrainingGroup(clubId, groupId)
    }

    suspend fun updateTrainingGroup(clubId: String, groupId: String, name: String): ClubActionResult {
        return repository.updateClubTrainingGroup(clubId, groupId, name)
    }

    suspend fun loadTrainingTimes(clubId: String): ClubTrainingTimesResult {
        return repository.loadClubTrainingTimes(clubId)
    }

    suspend fun createTrainingTime(
        clubId: String,
        trainingGroupId: String,
        weekday: Int,
        startTime: String,
        endTime: String
    ): ClubActionResult {
        return repository.createClubTrainingTime(
            clubId = clubId,
            trainingGroupId = trainingGroupId,
            weekday = weekday,
            startTime = startTime,
            endTime = endTime
        )
    }

    suspend fun deleteTrainingTime(clubId: String, timeId: String): ClubActionResult {
        return repository.deleteClubTrainingTime(clubId, timeId)
    }

    suspend fun updateTrainingTime(
        clubId: String,
        timeId: String,
        weekday: Int,
        startTime: String,
        endTime: String
    ): ClubActionResult {
        return repository.updateClubTrainingTime(
            clubId = clubId,
            timeId = timeId,
            weekday = weekday,
            startTime = startTime,
            endTime = endTime
        )
    }
}
