package p.studio.workspaces.assets.tiled;

import java.util.List;
import java.util.Objects;

public record TiledMapDocument(
        String version,
        String tiledVersion,
        String orientation,
        String renderOrder,
        int width,
        int height,
        int tileWidth,
        int tileHeight,
        int nextLayerId,
        int nextObjectId,
        List<TiledProperty> properties,
        List<TiledTilesetReference> tilesets,
        List<TiledTileLayer> tileLayers,
        List<TiledObjectLayer> objectLayers) {

    public TiledMapDocument {
        version = Objects.requireNonNullElse(version, "1.10");
        tiledVersion = Objects.requireNonNullElse(tiledVersion, "1.12.1");
        orientation = Objects.requireNonNullElse(orientation, "orthogonal");
        renderOrder = Objects.requireNonNullElse(renderOrder, "right-down");
        properties = List.copyOf(Objects.requireNonNull(properties, "properties"));
        tilesets = List.copyOf(Objects.requireNonNull(tilesets, "tilesets"));
        tileLayers = List.copyOf(Objects.requireNonNull(tileLayers, "tileLayers"));
        objectLayers = List.copyOf(Objects.requireNonNull(objectLayers, "objectLayers"));
    }
}
