import { Lead } from './lead.model'; import { Client } from '../client/client.model'; import { Organization } from '../organization/organization.model'; import { Member } from '../member/member.model'; export class LeadDeserializer { public deserialize(json: any): Lead { const lead: Lead = new Lead(); lead.id = json['id']; lead.vehicle = json['description']; lead.status = json['status']; lead.stage = json['current_stage']; lead.source = json['source']; lead.offerValue = json['offer_value']; lead.client = new Client(); lead.client.id = json['client_id']; lead.organization = new Organization(); lead.organization.id = json['organization_id']; if (json['assigned_to']) { lead.assignedMember = new Member(); lead.assignedMember.userId = json['assigned_to']; } return lead; } }