class Item {
    /**
     * Name of the item
     */
    get Name() {
        return this._decoder.decode(new Uint8Array(this._ptr.slice(0, 24)));
    }
    set Name(v) {
        this._data.set(this._encoder.encode(v), 0);
    }
    /**
     * Default starting value of the item
     */
    get BaseValue() {
        return this._data.getInt32(24, true);
    }
    set BaseValue(v) {
        return this._data.setInt32(24, v, true);
    }
    /** 
     * get the struct representation of the object
     */
    get bytes() {
        return new Uint8Array(this._ptr);
    }
    /**
     * constructor
     */
    constructor(init = {}, ptr = undefined) {
        this._size = 28;
        this._ptr = ptr.buffer || new ArrayBuffer(this._size);
        this._data = new DataView(this._ptr);
        
        this._encoder = new TextEncoder(); 
        this._decoder = new TextDecoder();          
        for (const key of Object.keys(init)) {
          this[key] = init[key];
        }
    }
}

export default Item