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 steppservice{
  private StepperURL = "Stepper_table_config/Stepper_table_config";
  private TestpremiumURL = "Testpremium/Testpremium" ;  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
  }  getAllTestpremium(page?: number, size?: number): Observable<any> {
    return this.apiRequest.get(this.TestpremiumURL);
  }
  getTestpremiumById(id: number): Observable<any> {
    const _http = this.TestpremiumURL + "/" + id;
    return this.apiRequest.get(_http);
  }
  createTestpremium(data: any): Observable<any> {
    return this.apiRequest.post(this.TestpremiumURL, data);
  }
  updateTestpremium(id: number, data: any): Observable<any> {
    const _http = this.TestpremiumURL + "/" + id;
    return this.apiRequest.put(_http, data);
  }
  deleteTestpremium(id: number): Observable<any> {
    const _http = this.TestpremiumURL + "/" + id;
    return this.apiRequest.delete(_http);
  }


// payment code start
  paytmPay(data: any): Observable<any> {
   const url = `payment/start`;    return this.apiRequest.post(url, data);
 }  
razorPay(orderData: any): Observable<any> {
   const url = `payment/razorpay/create-order`;
   return this.apiRequest.post(url, orderData);  }  // payment code end

// approve code
       create_approved(data: any): Observable<any> {
    const _http = "billing/approval" + "/" + "add"; 
    return this.apiRequest.post(_http, data);   }  // approved code end 



// updateaction
}