import { Injectable } from '@angular/core';
 
import { HttpClient } from '@angular/common/http';
 
import { BehaviorSubject, Observable, of } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { environment } from '../../environments/environment';
 
@Injectable({
  providedIn: 'root'
})
export class PageapiService {
  public orderDetails:BehaviorSubject<any> = new BehaviorSubject<any>([]);
public orderDetails_observable$ = this.orderDetails.asObservable();


public mixDetails:BehaviorSubject<any> = new BehaviorSubject<any>([]);
public mixDetails_observable$ = this.mixDetails.asObservable();

  private apiUrl = environment.apiEndpoint;
  constructor(private _http: HttpClient) { } 

  getusers(param): Observable<any> {
    //console.log(params.email)
    return this._http.post<any>(this.apiUrl + "getusers",param)
   
  }
  getSmtpList(param): Observable<any> {
    //console.log(params.email)
    return this._http.post<any>(this.apiUrl + "getSmtpList",param)
   
  }

  

  getDriverSummaryAdminList(param): Observable<any> {
    //console.log(params.email)
    return this._http.post<any>(this.apiUrl + "getDriverSummaryAdminList",param)
   
  }
  getDriverSheet(param): Observable<any> {
    //console.log(params.email)
    return this._http.post<any>(this.apiUrl + "getDriverSheetAdmin",param)
   
  }


  
  
  getReturnDriverSummaryListadmin(param): Observable<any> {
    //console.log(params.email)
    return this._http.post<any>(this.apiUrl + "getReturnDriverSummaryListadmin",param)
   
  }
  getProductDeliverysheet(param): Observable<any> {
    //console.log(params.email)
    return this._http.post<any>(this.apiUrl + "getProductDeliverysheet",param)
   
  }
  getProductReturnsheet(param): Observable<any> {
    //console.log(params.email)
    return this._http.post<any>(this.apiUrl + "getProductReturnsheet",param)
   
  }
  

  getProductListSummary(param): Observable<any> {
    //console.log(params.email)
    return this._http.post<any>(this.apiUrl + "getProductListSummary",param)
   
  }
  getReturnProductListSummary(param): Observable<any> {
    //console.log(params.email)
    return this._http.post<any>(this.apiUrl + "getReturnProductListSummary",param)
   
  }
  
  
  
  getProducts(param): Observable<any> {
    //console.log(params.email)
    return this._http.post<any>(this.apiUrl + "getProducts",param)
   
  }

  getOrders(param): Observable<any> {
    //console.log(params.email)
    return this._http.post<any>(this.apiUrl + "getOrders",param)
   
  }
  addUserFormDetails(addParams): Observable<any> {
    return this._http.post(this.apiUrl + 'createUsers', addParams)
     
  }
  CreateCustomersDetails(addParams): Observable<any> {
    return this._http.post(this.apiUrl + 'CreateCustomers', addParams)
     
  }
  CreateSmtpDetails(addParams): Observable<any> {
    return this._http.post(this.apiUrl + 'CreateSmtpDetails', addParams)
     
  }

  

  CreateProductDetails(addParams): Observable<any> {
    return this._http.post(this.apiUrl + 'CreateProducts', addParams)
     
  }
  CreateOrder(addParams): Observable<any> {
    return this._http.post(this.apiUrl + 'CreateOrder', addParams)
     
  }

  delOrder(addParams): Observable<any> {
    return this._http.post(this.apiUrl + 'delOrderCatogary', addParams)
     
  }

  getProductList(addParams): Observable<any> {
    return this._http.post(this.apiUrl + 'getProductList', addParams)
     
  }

  getProductDropdownList(addParams): Observable<any> {
    return this._http.post(this.apiUrl + 'getProductDropdownList', addParams)
     
  }
   
  CreateReturn(addParams:any): Observable<any> {
    return this._http.post(this.apiUrl + 'CreateReturn', addParams)
     
  }

  Notification(addParams:any): Observable<any> {
    return this._http.post(this.apiUrl + 'sendNotification', addParams)
     
  }
}

