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

import com.pixelized.shared.lwa.model.map.Map
import com.pixelized.shared.lwa.model.map.MapJsonV1

class MapJsonFactoryV1 {
    fun convertFromJson(
        json: MapJsonV1,
    ): Map {
        return Map(
            id = json.id,
            name = json.name,
            camera = Map.Camera(
                zoom = json.camera.zoom,
                offsetX = json.camera.offsetX,
                offsetY = json.camera.offsetY,
            ),
            size = Map.Size(
                width = json.size.width,
                height = json.size.height,
            ),
            resources = json.resources.map {
                Map.Resource(
                    id = it.id,
                    name = it.name,
                    uri = it.uri,
                )
            },
        )
    }
}