/**
 * Base abstract class for any managed resource such as a texture of a buffer
 */
export class ResourceDescriptor {

    /**
     * Resource type, useful for debugging and UI
     * Not guaranteed to be unique
     * @return {string}
     */
    get type() {
        return 'resource'
    }

    /**
     * For fast type checks
     * @return {boolean}
     */
    get isResourceDescriptor() {
        return true;
    }


    hash() {
        return 0;
    }

    /**
     * @template T {ResourceDescriptor}
     * @param {T} other
     * @returns {boolean}
     */
    equals(other) {
        return this.type === other.type;
    }


    /**
     *
     * @param {ResourceDescriptor} other
     * @return {number}
     */
    compare(other) {
        return this.type.localeCompare(other.type);
    }

    toString(){
        return this.type;
    }
}