import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import {BaseService} from '../../../base/base-service';
import {map} from 'rxjs/operators';

@Injectable({
  providedIn: 'root'
})
export class RecieptService extends BaseService {
  requestUrl;
  constructor(
    public http: HttpClient
  ) {
    super('/report/print/receipt', http)
  }

  getPdfReport(registeruid) {
    this.requestUrl = `${this.fullUrl}/${registeruid}/pdf`;
    return this.http.get(this.requestUrl, { responseType: 'blob', observe: 'response'}).pipe(
      map((res: any) => {
        return new Blob([res.body], { type: 'application/pdf' });
      })
    );
  }
}
