export default class Item {
    constructor() {
        this.id = "item";
        this.name = "An item";
        this.description = "You see nothing special about this item";
        this.usable = true;
        this.takeable = true;
        this.useCallback = null;
        this.takeCallback = null;
        this.dropCallback = null;
        this.tickCallback = null;
        this.context = null;
    }

    async onUse() {
        if (this.useCallback) return this.useCallback(this.context);
    }

    async onTake() {
        if (this.takeCallback) return this.takeCallback(this.context);
    }

    async onDrop() {
        if (this.dropCallback) return this.dropCallback(this.context);
    }
    async onTick() {
        if (this.tickCallback) return this.tickCallback(this.context);
    }

    addUseCallback(callback) {
        this.useCallback = callback.bind(this);
    }

    addTakeCallback(callback) {
        this.takeCallback = callback.bind(this);
    }

    addDropCallback(callback) {
        this.dropCallback = callback.bind(this);
    }

    addTickCallback(callback) {
        this.tickCallback = callback.bind(this);
    }
}