import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { environment } from '../../environments/environment';
let header = new HttpHeaders();
header = header.set('Content-Type', 'application/json; charset=utf-8');
@Injectable({
  providedIn: 'root'
})
export class CommonService {

  baseUrl: string = environment.serviceUrl;
  constructor(private httpClient: HttpClient) { }

  sendemail(email: string, emailtype: string): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/SendMailApi/sendemail/' + email + '/' + emailtype,
     { email }, { headers: header, observe: 'response' }
     );
  }
  getserPreferences(userpreference:any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/TopBarMenuApi/GetUserPreferences',userpreference,{ headers: header, observe: 'response' }
     );
  }
  postuserpreference(userpreference:any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/TopBarMenuApi/AddUserPreferences',userpreference,{ headers: header, observe: 'response' }
     );
  }
  UpadateUserPreferences(userpreference:any,updatetype:string): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/TopBarMenuApi/UpadateUserPreferences/'+updatetype,userpreference,{ headers: header, observe: 'response' }
     );
  }

}
