import {Observable} from 'rxjs';
import {PeopleService} from '../service/people.service';

export class PeopleModel{
  constructor(
    public Id: string,
    public First: string,
    public Last: string,
    public Middle: string,
    public Title: string,
    public Display: string,
    public Nick: string,
    public Enabled: boolean,
  ){}

  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('', '', '', '', '', '', '', false );
  }

  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;
}
