import { DiscountProductList } from '@/manager/modules/discount/components/DiscountProductList';
import { DiscountEditProductsDialog } from '@/manager/modules/discount/views/DiscountEditProductsDialog';
import { getCardEditButtonHost, getCardHost } from '@/manager/shared/utils/locator-utils';
import { BaseComponent } from '@/shared/base/BaseComponent';

export class DiscountProductCard extends BaseComponent {
  readonly main = getCardHost(this.host, 'Redeemable for these deposits and one-time products');
  readonly editButton = getCardEditButtonHost(this.main);
  readonly list = new DiscountProductList(this.main);

  async openDiscountEditProductsDialog(showAlerts: boolean): Promise<DiscountEditProductsDialog> {
    await this.editButton.click();
    return new DiscountEditProductsDialog(this.host.page(), showAlerts);
  }
}
