package com.pixelized.desktop.lwa.ui.screen.campaign.player.ribbon

import com.pixelized.desktop.lwa.repository.alteration.AlterationRepository
import com.pixelized.desktop.lwa.repository.campaign.CampaignRepository
import com.pixelized.desktop.lwa.repository.characterSheet.CharacterSheetRepository
import com.pixelized.desktop.lwa.repository.roll_history.RollHistoryRepository
import com.pixelized.desktop.lwa.repository.settings.SettingsRepository
import com.pixelized.desktop.lwa.repository.settings.model.Settings
import com.pixelized.shared.lwa.model.campaign.Campaign

class NpcRibbonViewModel(
    rollHistoryRepository: RollHistoryRepository,
    settingsRepository: SettingsRepository,
    characterRepository: CharacterSheetRepository,
    alterationRepository: AlterationRepository,
    campaignRepository: CampaignRepository,
    ribbonFactory: CharacterRibbonFactory,
) : CharacterRibbonViewModel(
    rollHistoryRepository = rollHistoryRepository,
    settingsRepository = settingsRepository,
    characterRepository = characterRepository,
    alterationRepository = alterationRepository,
    campaignRepository = campaignRepository,
    ribbonFactory = ribbonFactory,
) {
    override fun fetch(
        campaign: Campaign,
        settings: Settings,
    ): Set<String> {
        return if (campaign.options.showNpcs || settings.isGameMaster == true) campaign.npcs else emptySet()
    }

    override fun hideOverruled(campaign: Campaign, settings: Settings): Boolean {
        return !campaign.options.showNpcs && settings.isGameMaster == true
    }

    override fun enableCharacterSheet(settings: Settings): Boolean {
        return settings.isGameMaster ?: false
    }

    override fun enableCharacterStats(settings: Settings): Boolean {
        return settings.isGameMaster ?: false
    }

    override fun enableCharacterStatus(settings: Settings): Boolean {
        return settings.isGameMaster ?: false
    }
}