package com.pixelized.shared.lwa.model.campaign.factory

import com.pixelized.shared.lwa.model.campaign.Campaign
import com.pixelized.shared.lwa.model.campaign.CampaignJsonV2

class CampaignJsonV2Factory {

    fun convertFromJson(
        campaignJson: CampaignJsonV2,
    ): Campaign {
        return Campaign(
            characters = campaignJson.characters,
            npcs = campaignJson.npcs,
            scene = campaignJson.scene
                ?.let { convertFromJson(it) }
                ?: Campaign.Scene.empty(),
            options = campaignJson.options
                ?.let { convertFromJson(it) }
                ?: Campaign.Options.empty()
        )
    }

    fun convertFromJson(
        sceneJson: CampaignJsonV2.SceneJsonV2,
    ): Campaign.Scene {
        return Campaign.Scene(
            name = sceneJson.name
        )
    }

    fun convertFromJson(
        optionsJson: CampaignJsonV2.OptionsJsonV2,
    ): Campaign.Options {
        return Campaign.Options(
            showParty = optionsJson.showPlayer,
            showNpcs = optionsJson.showNpcs
        )
    }
}