package de.oaa.xxx.games.chastity.cardlock;

import de.oaa.xxx.games.history.GameHistoryRepository;
import de.oaa.xxx.games.chastity.community.CommunityTaskVoteRepository;
import de.oaa.xxx.games.chastity.community.CommunityVerificationRepository;
import de.oaa.xxx.games.chastity.community.CommunityVerificationVoteRepository;
import de.oaa.xxx.games.chastity.keyholder.KeyholderNotificationRepository;
import de.oaa.xxx.games.chastity.keyholder.KeyholderTaskChoiceRepository;
import de.oaa.xxx.games.chastity.keyholder.KeyholderVerificationRepository;
import de.oaa.xxx.games.chastity.unlock.UnlockCodeHistoryService;
import de.oaa.xxx.social.SystemMessageService;
import de.oaa.xxx.user.UserRepository;
import org.springframework.stereotype.Service;

/**
 * Factory für CardLockService-Instanzen.
 *
 * CardLockService hält pro Instanz den Zustand eines konkreten CardLockEntity
 * und kann daher kein Singleton-Bean sein. Diese Factory zentralisiert die
 * Erzeugung und verwaltet alle Abhängigkeiten als injizierte Singletons.
 */
@Service
public class CardLockServiceFactory {

    private final CardLockRepository cardLockRepository;
    private final CommunityVerificationRepository communityVerificationRepository;
    private final CommunityVerificationVoteRepository communityVerificationVoteRepository;
    private final GameHistoryRepository gameHistoryRepository;
    private final UserRepository userRepository;
    private final UnlockCodeHistoryService unlockCodeHistoryService;
    private final KeyholderNotificationRepository keyholderNotificationRepository;
    private final KeyholderVerificationRepository keyholderVerificationRepository;
    private final SystemMessageService systemMessageService;
    private final KeyholderTaskChoiceRepository keyholderTaskChoiceRepository;
    private final CommunityTaskVoteRepository communityTaskVoteRepository;

    public CardLockServiceFactory(
            CommunityVerificationRepository communityVerificationRepository,
            CommunityVerificationVoteRepository communityVerificationVoteRepository,
            CardLockRepository cardLockRepository,
            GameHistoryRepository gameHistoryRepository,
            UserRepository userRepository,
            KeyholderNotificationRepository keyholderNotificationRepository,
            KeyholderVerificationRepository keyholderVerificationRepository,
            UnlockCodeHistoryService unlockCodeHistoryService,
            SystemMessageService systemMessageService,
            KeyholderTaskChoiceRepository keyholderTaskChoiceRepository,
            CommunityTaskVoteRepository communityTaskVoteRepository) {
        this.cardLockRepository = cardLockRepository;
        this.communityVerificationRepository = communityVerificationRepository;
        this.communityVerificationVoteRepository = communityVerificationVoteRepository;
        this.gameHistoryRepository = gameHistoryRepository;
        this.userRepository = userRepository;
        this.keyholderNotificationRepository = keyholderNotificationRepository;
        this.unlockCodeHistoryService = unlockCodeHistoryService;
        this.keyholderVerificationRepository = keyholderVerificationRepository;
        this.systemMessageService = systemMessageService;
        this.keyholderTaskChoiceRepository = keyholderTaskChoiceRepository;
        this.communityTaskVoteRepository = communityTaskVoteRepository;
    }

    /**
     * Erstellt eine neue CardLockService-Instanz für das gegebene Lock.
     */
    public CardLockService create(CardLockEntity lock) {
        return new CardLockService(lock, communityVerificationVoteRepository, communityVerificationRepository,
                keyholderVerificationRepository, gameHistoryRepository, userRepository,
                keyholderNotificationRepository, systemMessageService, unlockCodeHistoryService,
                keyholderTaskChoiceRepository, communityTaskVoteRepository, cardLockRepository);
    }
}
