import { Container } from "../../../pixi/pixi.mjs";
import { SceneObject } from "../../SceneObjects/SceneObject";
import { TerrainTile } from "../WorldObjects/TerrainTile/TerrainTile";

export class ChunkStorageTypes
{
    static TYPE_TERRAIN = 0;
    static TYPE_VEGETATION = 1;
    static TYPE_BUILDINGS = 2;
    static TYPE_NPC = 3;
};

export class WorldChunk extends SceneObject
{   
    /**
     * @type Map<String, TerrainTile>
     */
    terrainStorage = new Map();

    /**
     * 
     * @param {SceneObject} object 
     * @param {ChunkStorageTypes} storageType 
     * @param {String} objectId 
     */
    addToChunk(object, storageType, objectId)
    {
        switch (storageType) {
            case 0:
                this.terrainStorage.set(objectId, object);
                break;
        
            default:
                break;
        }
        this.drawObject.addChild(object.drawObject);
    }

    /**
     * 
     * @param {SceneObject} object 
     * @param {ChunkStorageTypes} storageType 
     * @param {String} objectId 
     */
    removeFromChunk(object, storageType, objectId)
    {
        switch (storageType) {
            case 0:
                this.terrainStorage.delete(objectId);
                break;
        
            default:
                break;
        }
        this.drawObject.removeChild(object);
    }
};