package com.jan.scene;

import java.util.Iterator;
import com.badlogic.gdx.maps.MapObject;

public abstract class Entity {
    private MapObject objectData;

    private String entityName;
    private String entityType;
    private int entityID;

    public Entity(MapObject mapObject){
        objectData = mapObject;
        entityName = objectData.getName();
        entityType = (String)loadProperty("type");
        entityID = (int)loadProperty("id");
    }

    public void update(){}

    protected void verifyData(){
        if(isDataLoaded() == false)
            System.out.println("het");
    }
    private boolean isDataLoaded(){
        Iterator<String> props = objectData.getProperties().getKeys();
        return !props.hasNext();
    }

    protected Object loadProperty(String property){
        Object newProperty = objectData.getProperties().get(property);
        objectData.getProperties().remove(property);
        return newProperty;
    }

    public String getEntityClass(){ return entityType; }
    public String getEntityName(){ return entityName; }
    public int getEntityID() { return entityID; }
}