import { getStripeInputHost } from '@/manager/shared/utils/locator-utils';
import { BaseComponent } from '@/shared/base/BaseComponent';
import { CardPaymentSection } from '@/shared/modules/payment-method/components/CardPaymentSection';
import { CardPayment } from '@/shared/modules/payment-method/payment-method-types';

export class CardPaymentMethodAddForm extends BaseComponent {
  readonly cardPaymentSection = new CardPaymentSection(getStripeInputHost(this.host, 'Secure payment input frame'));
  readonly checkbox = this.host.getByTestId('accept-terms-checkbox');

  async fill(data: CardPayment): Promise<void> {
    await this.cardPaymentSection.fill(data);
    await this.checkbox.click();
  }
}
