package cz.moneta.test.dsl.newib.investments;

import cz.moneta.test.dsl.newib.NewIbPageFlow;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.TypeInto;
import cz.moneta.test.harness.support.web.Wait;
import cz.moneta.test.harness.support.web.Waits;
import cz.moneta.test.harness.support.web.Until;

public interface InvestmentsSaleDialog extends NewIbPageFlow<InvestmentsSaleDialog> {
    String AMOUNT = "//input[@id='amount']";

    String SUBMIT_BUTTON = "//button[@data-testid='continueToSale'][not (@aria-disabled) or @aria-disabled='false']";
    String MOBILE_KEY_INPUT = "//input[@id='mobileKey']";
    String SALE_ANYWAY_BUTTON = "//button[@data-testid='sureToSale']";
    String EARLY_SALE_MODAL_HEADER = "//header[@data-testid='earlySaleModalHeader']";
    String EARLY_SALE_MODAL_CONTENT = "//div[@data-testid='earlySaleModalContent']";
    String SECOND_FACTOR_SUBMIT_BUTTON = "//button[@data-testid='secondFactorSend'][not (@aria-disabled) or @aria-disabled='false']";

    @TypeInto(AMOUNT)
    InvestmentsSaleDialog fillAmount(String individualAmount);

    @Click(SUBMIT_BUTTON)
    InvestmentsSaleDialog clickSubmit();

    @Waits({
            @Wait(value = SALE_ANYWAY_BUTTON, until = Until.VISIBLE),
            @Wait(value = EARLY_SALE_MODAL_HEADER, until = Until.VISIBLE),
            @Wait(value = EARLY_SALE_MODAL_CONTENT, until = Until.VISIBLE)})
    @Click(SALE_ANYWAY_BUTTON)
    InvestmentsSaleDialog clickSaleAnyway();

    @TypeInto(MOBILE_KEY_INPUT)
    InvestmentsSaleDialog fillMobileKey(String mobileKey);

    @Click(SECOND_FACTOR_SUBMIT_BUTTON)
    InvestmentsSaleVictory clickSecondFactorSubmit();
}