export class Customer { public static fromJson (obj: any) { return new Customer( obj.tenantId, obj.firstName, obj.lastName, obj.avatar, obj.gender, obj.id, obj.social, obj.badges, obj.addresses, obj.telephones, obj.storeId, obj.userId ); } public toJson() { let customerJson: any = { // created & __v fields may need handling id: this.getId(), tenantId: this.getTenantId(), firstName: this.getFirstName(), lastName: this.getLastName(), social: this.getSocial(), badges: this.getBadges(), addresses: this.getAddresses(), telephones: this.getTelephones(), storeId: this.getStoreId(), userId: this.getUserId() }; return customerJson; } constructor(public tenantId: string, public firstName: string, public lastName: string, public avatar: string, public gender: string, public id: string, public social: string, public badges: any, public addresses: any, public telephones: any, public storeId: string, public userId: string) { } getTenantId() { return this.tenantId; } getFirstName() { return this.firstName; } getLastName() { return this.lastName; } getAvatar() { return this.avatar; } getGender() { return this.gender; } getId() { return this.id; } getSocial() { return this.social; } getBadges() { return this.badges; } getEngaged() { return this.badges["engaged"];} getVip() { return this.badges["vip"];} getInstore() { return this.badges["inStore"];} getAddresses() { return this.addresses; } getTelephones() { return this.telephones; } getStoreId() { return this.storeId; } getUserId() { return this.userId; } }