import { IPaginatedResponse } from '@/core/models/service.model';
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { PARTNER_CUSTOMERS_API_ROUTES } from '../constants';
import { ICustomerRawResponse, ICustomerResponse } from '../models';

@Injectable({ providedIn: 'root' })
export class CustomersService {
  constructor(private http: HttpClient) {}

  private apiRoutes = PARTNER_CUSTOMERS_API_ROUTES;

  getAll(): Observable<IPaginatedResponse<ICustomerResponse>> {
    return this.http.get<IPaginatedResponse<ICustomerRawResponse>>(this.apiRoutes.list());
  }
  getSingle(customerId: string): Observable<ICustomerResponse> {
    return this.http.get<ICustomerRawResponse>(this.apiRoutes.single(customerId));
  }
}
