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 test_vps_steperservice{
  private StepperURL = "Stepper_table_config/Stepper_table_config";
  private Customer_informationURL = "Customer_information/Customer_information" ;  private Document_uploadURL = "Document_upload/Document_upload" ;  constructor(
    private http: HttpClient,
    private apiRequest: ApiRequestService,
  ) { }
gettabledata(id: number): Observable<any> {
    const _http = this.StepperURL + "/stepId/" + id;
    return this.apiRequest.get(_http);
  }

  saveStepperConfig(stepperId: number, tableId: number, tableName: string): Observable<any> {
    const params = new HttpParams()
      .set('stepperId', stepperId.toString())
      .set('tableId', tableId.toString())
      .set('tableName', tableName);

    return this.apiRequest.post(this.StepperURL, null, params); // null body, params used
  }  getAllCustomer_information(page?: number, size?: number): Observable<any> {
    return this.apiRequest.get(this.Customer_informationURL);
  }
  getCustomer_informationById(id: number): Observable<any> {
    const _http = this.Customer_informationURL + "/" + id;
    return this.apiRequest.get(_http);
  }
  createCustomer_information(data: any): Observable<any> {
    return this.apiRequest.post(this.Customer_informationURL, data);
  }
  updateCustomer_information(id: number, data: any): Observable<any> {
    const _http = this.Customer_informationURL + "/" + id;
    return this.apiRequest.put(_http, data);
  }
  deleteCustomer_information(id: number): Observable<any> {
    const _http = this.Customer_informationURL + "/" + id;
    return this.apiRequest.delete(_http);
  }












































  getAllDocument_upload(page?: number, size?: number): Observable<any> {
    return this.apiRequest.get(this.Document_uploadURL);
  }
  getDocument_uploadById(id: number): Observable<any> {
    const _http = this.Document_uploadURL + "/" + id;
    return this.apiRequest.get(_http);
  }
  createDocument_upload(data: any): Observable<any> {
    return this.apiRequest.post(this.Document_uploadURL, data);
  }
  updateDocument_upload(id: number, data: any): Observable<any> {
    const _http = this.Document_uploadURL + "/" + id;
    return this.apiRequest.put(_http, data);
  }
  deleteDocument_upload(id: number): Observable<any> {
    const _http = this.Document_uploadURL + "/" + id;
    return this.apiRequest.delete(_http);
  }
  uploadImageupload_field(ref:any, Document_upload:any, file:any): Observable<any>{
    const formData = new FormData();
    formData.append('file', file);
    return this.apiRequest.postFormData(`FileUpload/Uploadeddocs/${ref}/${Document_upload}`, formData);
  }

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


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

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

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


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

// updateaction
}