import { Injectable } from '@angular/core';
import { Observable } from "rxjs";
import { HttpClient, HttpHeaders, HttpParams, } from "@angular/common/http";
import { ApiRequestService } from "src/app/services/api/api-request.service";
import { environment } from 'src/environments/environment';
import baseUrl from 'src/app/services/api/helper';
@Injectable({
  providedIn: 'root'
})
export class Visa_pricesservice{
  private baseURL = "Visa_prices/Visa_prices" ;  constructor(
    private http: HttpClient,
    private apiRequest: ApiRequestService,
  ) { }
  getAll(page?: number, size?: number): Observable<any> {
    return this.apiRequest.get(this.baseURL);
  }
  getById(id: number): Observable<any> {
    const _http = this.baseURL + "/" + id;
    return this.apiRequest.get(_http);
  }
  create(data: any): Observable<any> {
    return this.apiRequest.post(this.baseURL, data);
  }
  update(id: number, data: any): Observable<any> {
    const _http = this.baseURL + "/" + id;
    return this.apiRequest.put(_http, data);
  }
  delete(id: number): Observable<any> {
    const _http = this.baseURL + "/" + id;
    return this.apiRequest.delete(_http);
  }






getAllvisa_entry_type(): Observable<any> {   
return this.apiRequest.get("Visa_entry_ListFilter1/Visa_entry_ListFilter1");  }

getAllvisa_duration(): Observable<any> {   
return this.apiRequest.get("Visa_duration_ListFilter1/Visa_duration_ListFilter1");  }

getAllvisa_processing(): Observable<any> {   
return this.apiRequest.get("Visa_Processing_ListFilter1/Visa_Processing_ListFilter1");  }





downloadCSV(tableName: string): Observable<Blob> {
  const url = `${baseUrl}/api/template/download-csv?tableName=${tableName}`;
  return this.http.get(url, { responseType: 'blob' })

}// updateaction
}