import { inject, Injectable } from '@angular/core';
import { CrmSearchService } from '../services/crm-search.service';
import { FetchCustomerInput, Customer } from '../schemas';

@Injectable({ providedIn: 'root' })
export class CustomerFacade {
  #customerService = inject(CrmSearchService);

  async fetchCustomer(
    params: FetchCustomerInput,
    abortSignal?: AbortSignal,
  ): Promise<Customer | undefined> {
    const res = await this.#customerService.fetchCustomer(params, abortSignal);
    return res.result;
  }
}
