import { Injectable } from '@angular/core';
import { environment } from '../../environments/environment';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import { Email } from 'app/models/email';

@Injectable()
export class EmailService {

  private rootUrl = environment.apiUrl;
  private apiBasePath = `${this.rootUrl}orchestrate`;

  userEmailStatusUrl = `${this.apiBasePath}/getEmailHistory`;

  constructor(
    private http: HttpClient
  ) { }

  getUserEmailsStatus(email): Observable<Email[]> {
    return this.http.get<Email[]>(`${this.userEmailStatusUrl}/${email}`);
  }

}
