import {PeopleModel} from './people.model';
import {UserExtraModel} from './user-extra.model';

export class BrokerModel{
  constructor(
    public Id: string,
    public First: string,
    public Last: string,
    public Middle: string,
    public Title: string,
    public Display: string,
    public Nick: string,
    public Login: string,
    public Enabled: boolean,
    public BSB: string,
    public ACC: string,
    public License: string,
    public Organization: string
  ){}



  public static EmptyNew(): BrokerModel {
    return new BrokerModel('', '', '', '', '', '', '',
      '', false, '', '',  '', '');
  }

  public static getFromUserAndExtra(u: PeopleModel, ex: UserExtraModel): BrokerModel {
    return new BrokerModel(
      u.Id, u.First, u.Last, u.Middle, u.Title, u.Display, u.Nick, ex.Login, u.Enabled, ex.BSB, ex.ACC, ex.License, ex.Organization
    );
  }

  public toPeopleModel(): PeopleModel{
    return new PeopleModel( this.Id, this.First, this.Last, this.Middle, this.Title, this.Display, this.Nick, this.Enabled );
  }
}
