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';
@Injectable({
  providedIn: 'root'
})
export class Formbservice{
  private baseURL = "Formb/Formb" ;  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);
  }
















  uploadfilefileuploadj(ref:any, Formb:any, file:any): Observable<any>{
    const formData = new FormData();
    formData.append('file', file);
    return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Formb}`, formData);
  }

  uploadfilegetByIdfileuploadj(ref:any, Formb:any,): Observable<any> {
    return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Formb}`);
  }


  uploadfiledeletefileuploadj(id: number): Observable<any> {
    return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
  }

  uploadImageuploadh(ref:any, Formb:any, file:any): Observable<any>{
    const formData = new FormData();
    formData.append('file', file);
    return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Formb}`, formData);
  }

  uploadImageuploadhgetById(ref:any, Formb:any,): Observable<any> {
    return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Formb}`);
  }


  uploadImageuploadhdelete(id: number): Observable<any> {
    return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
  }

  uploadAudioh(ref:any, Formb:any, file:any): Observable<any>{
    const formData = new FormData();
    formData.append('file', file);
    return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Formb}`, formData);
  }

  uploadAudiohgetById(ref:any, Formb:any,): Observable<any> {
    return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Formb}`);
  }


  uploadAudiohdelete(id: number): Observable<any> {
    return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
  }

  uploadVideoh(ref:any, Formb:any, file:any): Observable<any>{
    const formData = new FormData();
    formData.append('file', file);
    return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Formb}`, formData);
  }

  uploadVideohgetById(ref:any, Formb:any,): Observable<any> {
    return this.apiRequest.get(`FileUpload/Uploadeddocs/${ref}/${Formb}`);
  }


  uploadVideohdelete(id: number): Observable<any> {
    return this.apiRequest.delete(`FileUpload/Uploadeddocs/${id}`);
  }

// updateaction
}