import { IListable } from '@iqser/common-ui';

export interface IComponentDefinition {
    id: string;
    dossierTemplateId: string;
    technicalName: string;
    displayName: string;
    description: string;
    rank: number;
}

export class ComponentDefinition implements IComponentDefinition, IListable {
    readonly id: string;
    readonly dossierTemplateId: string;
    readonly technicalName: string;
    readonly displayName: string;
    readonly description: string;
    readonly rank: number;

    constructor(componentDefinition: IComponentDefinition) {
        this.id = componentDefinition.id;
        this.dossierTemplateId = componentDefinition.dossierTemplateId;
        this.technicalName = componentDefinition.technicalName;
        this.displayName = componentDefinition.displayName;
        this.description = componentDefinition.description;
        this.rank = componentDefinition.rank;
    }

    get searchKey(): string {
        return this.displayName;
    }
}
