import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { MailTemplate } from './mailtemplate';
import { environment } from '../../../environments/environment';
let header = new HttpHeaders();
header = header.set('Content-Type', 'application/json; charset=utf-8');
@Injectable({
  providedIn: 'root'
})
export class MailtemplateService {
  baseUrl: string = environment.serviceUrl;
  constructor(private httpClient: HttpClient) { }
  Get(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/MailTemplateApi');
  }
  GetActive(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/MailTemplateApi/GetActiveTemplate');
  }
  Post(mailTemplate: MailTemplate): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/MailTemplateApi/Add', mailTemplate, { headers: header, observe: 'response' })
  }
  GetById(mailTemplate: MailTemplate): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/MailTemplateApi/GetById', mailTemplate, { headers: header, observe: 'response' });
  }
  Put(mailTemplate: MailTemplate): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/MailTemplateApi/Update', mailTemplate, { headers: header, observe: 'response' })
  }
  Delete(mailTemplate: MailTemplate) {
    return this.httpClient.post<any>(this.baseUrl + 'api/MailTemplateApi/activeordeactive', mailTemplate, { headers: header, observe: 'response' })
  }

}
