import { SingleAutocomplete } from '@/manager/shared/components/SingleAutocomplete';
import { BaseComponent } from '@/shared/base/BaseComponent';
import { Discount } from '@/shared/types/discount-types';

export class BookingCreateDiscountPickerTable extends BaseComponent {
  readonly main = this.host.getByTestId('booking-form-discounts');
  readonly discountAutocomplete = new SingleAutocomplete(this.main.getByTestId('content-column-1'));
  readonly addButton = this.main.getByTestId('app-link-button');

  async select(discount: Discount): Promise<void> {
    await this.addButton.click();
    await this.discountAutocomplete.fill(discount.name);
  }
}
