
export class PeopleModel{
  public Id: string;
  public First: string;
  public Last: string;
  public Middle: string;
  public Title: string;
  public Display: string;
  public Nick: string;
  public Enabled: boolean;

  constructor(payload?: Partial<PeopleModel>){
    if (! payload ) { payload = {} ; }
    this.Id = payload.Id || '';
    this.First = payload.First || '';
    this.Last = payload.Last || '';
    this.Middle = payload.Middle || '';
    this.Title = payload.Title || '';
    this.Display = payload.Display || '';
    this.Nick = payload.Nick || '';
    this.Enabled = payload.Enabled || false;
  }

  get FullName(): string {
    if (this.Middle === '') {
      return this.First + ' ' + this.Last;
    }else{
      return this.First + ' ' + this.Middle + ' ' + this.Last;
    }
  }

  public static EmptyNew(): PeopleModel {
    return new PeopleModel({});
  }

  public Copy(ppl: PeopleModel): void {
    this.Id = ppl.Id;
    this.First = ppl.First;
    this.Last = ppl.Last;
    this.Middle = ppl.Middle;
    this.Title = ppl.Title;
    this.Display = ppl.Display;
    this.Nick = ppl.Nick;
    this.Enabled = ppl.Enabled;
  }

  public Clear(): void {
    this.Id = '';
    this.First = '';
    this.Last = '';
    this.Middle = '';
    this.Title = '';
    this.Display = '';
    this.Nick = '';
    this.Enabled = false;
  }
}


export class RelevantPeopleModel{
  Id: string; Display: string; Role: string;
}
