import { inject, Injectable } from '@angular/core';
import { CrmSearchService } from '../services/crm-search.service';
import { AddBookingInput } from '../schemas';
import {
  KeyValueDTOOfStringAndInteger,
  KeyValueDTOOfStringAndString,
  LoyaltyBookingInfoDTO,
} from '@generated/swagger/crm-api';

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

  async fetchBookingReasons(
    abortSignal?: AbortSignal,
  ): Promise<KeyValueDTOOfStringAndInteger[]> {
    return this.#crmSearchService.fetchBookingReasons(abortSignal);
  }

  async fetchCurrentBookingPartnerStore(
    abortSignal?: AbortSignal,
  ): Promise<KeyValueDTOOfStringAndString | undefined> {
    return this.#crmSearchService.fetchCurrentBookingPartnerStore(abortSignal);
  }

  async addBooking(
    params: AddBookingInput,
  ): Promise<LoyaltyBookingInfoDTO | undefined> {
    return this.#crmSearchService.addBooking(params);
  }
}
