import BaseEntity from '../../common/entities/BaseEntity'; import ValidableInterface from '../../common/interfaces/ValidableInterface'; export default class SupplierKeyContact extends BaseEntity implements ValidableInterface { protected _name: string; protected _position: string; protected _email: string; get name(): string { return this._name; } set name(value: string) { this._name = value; } get position(): string { return this._position; } set position(value: string) { this._position = value; } get email(): string { return this._email; } set email(value: string) { this._email = value; } isValid(): boolean { return this.invalidFields().length === 0; } invalidFields() { let fields = []; !this.name && fields.push('name'); !this.position && fields.push('position'); !this.email && fields.push('email'); return fields; } }