import { type DeepImmutable } from '@babylonjs/core/types';
import { type BimObjectAttributeValue } from './bim-format-types';
import type { ModelEntityType, T8PropertySet, T8QuantitySet, T8Unit } from '@twinfinity/t8-client-model';

export interface BimIndexableIfcObject {
    [attribute: string]: BimObjectAttributeValue | undefined;
}

const emptyRecord = Object.freeze({}) as Record<string, never>;
export class BimTypeObject implements ModelEntityType {
    constructor(
        public readonly id: number,
        public readonly globalId: string,
        public readonly ifcClass: string,
        public readonly tag?: string,
        public readonly name?: string,
        public readonly description?: string,
        /**
         * Contains type specific attributes (e.g operationMode)
         * Readonly
         */
        public readonly attributes: DeepImmutable<BimIndexableIfcObject> = {}
    ) {}

    public get className(): string {
        return this.ifcClass;
    }

    public get data(): Record<string, string | number | boolean> {
        return this.attributes as Record<string, string | number | boolean>;
    }

    public readonly propertySets: Record<string, T8PropertySet<T8Unit>> = emptyRecord;
    public readonly quantitySets: Record<string, T8QuantitySet<T8Unit>> = emptyRecord;
}
