import { DataManagementProfileField } from "./DataManagementProfileField"; import { Serializable } from "../interfaces/Serializable"; import { JsonSerializer } from "../../utilities/JsonSerializer"; import { DataManagementPlanProfile } from "./DataManagementPlanProfile"; import { FormGenerator } from "../interfaces/FormGenerator"; import { FormGroup, FormBuilder } from "@angular/forms"; import { BaseErrorModel } from "../error/BaseErrorModel"; export class DataManagementPlanProfileModel implements Serializable, FormGenerator{ public id: string; public label: string; public definition: DataManagementPlanProfile = new DataManagementPlanProfile(); public status: number; public created: Date; public modified: Date; public errorModel: BaseErrorModel = new BaseErrorModel(); fromJSONObject(item: any): DataManagementPlanProfileModel { this.id = item.id; this.label = item.label; this.definition = JsonSerializer.fromJSONObject(item.definition, DataManagementPlanProfile); this.status = item.status; this.created = item.created; this.modified = item.modified; return this; } buildForm(): FormGroup { let formGroup = new FormBuilder().group({ id: [this.id], label: [this.label], status: [this.status], created: [this.created], modified: [this.modified] }) formGroup.addControl("definition", this.definition.buildForm()); return formGroup; } }