import {Injectable} from '@angular/core';
import {ResourceBase} from '../../../../core/api/resource';
import {HttpClient} from '@angular/common/http';
import { Observable } from "rxjs";
import { catchError } from "rxjs/operators";

@Injectable({
	providedIn: 'root'
})
export class ClientesService extends ResourceBase {

	constructor(public http: HttpClient) {
		super(http, 'administrador/clientes');
	}

	public sucursales(url) : Observable<any> {
		return this.http.get(this.baseUrl+url).pipe(
			catchError(this.handleError('index'))
		);
	}

	public asesores(url) : Observable<any> {
		return this.http.get(this.baseUrl+url).pipe(
			catchError(this.handleError('index'))
		);
	}

	public formasPago(url) : Observable<any> {
		return this.http.get(this.baseUrl+url).pipe(
			catchError(this.handleError('index'))
		);
	}

	public metodoPago(url) : Observable<any> {
		return this.http.get(this.baseUrl+url).pipe(
			catchError(this.handleError('index'))
		);
	}

	public tipoComprobante(url) : Observable<any> {
		return this.http.get(this.baseUrl+url).pipe(
			catchError(this.handleError('index'))
		);
	}

	public usoCFDI(url) : Observable<any> {
		return this.http.get(this.baseUrl+url).pipe(
			catchError(this.handleError('index'))
		);
	}
}
