import { DiscountProductList } from '@/manager/modules/discount/components/DiscountProductList';
import { DiscountEditProductsDialog } from '@/manager/modules/discount/views/DiscountEditProductsDialog';
import { getCardEditButtonHost, getCardHost } from '@/manager/shared/utils/host-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(showSnackbar: boolean): Promise<DiscountEditProductsDialog> {
    await this.editButton.click();
    return new DiscountEditProductsDialog(this.host.page(), showSnackbar);
  }
}
