import { BaseErrorModel } from '../error/BaseErrorModel'; import { Serializable } from "../Serializable"; import { FormGenerator } from "../interfaces/FormGenerator"; import { FormGroup, FormBuilder } from "@angular/forms"; import { ValidationContext } from '../../utilities/validators/ValidationContext'; export enum ExternalDatasetType { Source = 0, Output = 1 } export class ExternalDatasetModel implements Serializable, FormGenerator{ public abbreviation: String; public id: String; public label: String; public reference: String; public errorModel: BaseErrorModel; public type: ExternalDatasetType; public info: String; constructor(id?: string, abbreviation?: string, label?: string, reference?: string, info?: string, type?: ExternalDatasetType) { this.id = id; this.label = label; this.abbreviation = abbreviation; this.reference = reference; this.info = info; this.type = type; } fromJSONObject(item: any): ExternalDatasetModel { this.abbreviation = item.abbreviation; this.id = item.id; this.label = item.label; this.reference = item.reference; this.type = item.type; this.info = item.info return this; } buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup { return new FormBuilder().group({ id: [this.id], abbreviation: [this.abbreviation], label: [this.label], reference: [this.reference], type: [this.type], info: [this.info] }) } }