package cz.moneta.test.dsl.ufo.banka.pages.cards.credit;

import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.ufo.UfoEndpoint;
import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.ufo.banka.pages.cards.credit.ONC001_S001_QuickCreditCardRequestPage.CREDIT_AMOUNT_INPUT;
import static cz.moneta.test.dsl.ufo.banka.pages.cards.credit.ONC001_S001_QuickCreditCardRequestPage.ONC001_S001_PAGE_LABEL_XPATH;

@Wait(value = ONC001_S001_PAGE_LABEL_XPATH, by = Lookup.XPATH, waitSecondsForElement = 60)
@Wait(CREDIT_AMOUNT_INPUT)
public interface ONC001_S001_QuickCreditCardRequestPage extends WebFlow<ONC001_S001_QuickCreditCardRequestPage>, StoreAccessor {
    String ONC001_S001_PAGE_LABEL_XPATH = "//div[text()='ONC001_S001']";
    String CREDIT_AMOUNT_INPUT = "ONC001_S001_E004";
    String ADVANTAGE_SELECT = "ONC001_S001_C005";
    String PROMO_EVENT_SELECT = "ONC001_S001_C001";
    String WITHOUT_RECOMMENDATION_CHECKBOX = "ONC001_S001_H003_1";
    String SEND_BUTTON = "ONC001_S001_B001";

    @TypeInto(CREDIT_AMOUNT_INPUT)
    ONC001_S001_QuickCreditCardRequestPage fillCreditAmountInput(String creditAmount);

    @Select(ADVANTAGE_SELECT)
    ONC001_S001_QuickCreditCardRequestPage selectAdvantage(String advantage);

    @Select(PROMO_EVENT_SELECT)
    ONC001_S001_QuickCreditCardRequestPage selectPromoEvent(String promoEventName);

    @Click(WITHOUT_RECOMMENDATION_CHECKBOX)
    ONC001_S001_QuickCreditCardRequestPage clickWithoutRecommendationCheckbox();

    @Click("ONC001_S001_H001_1")
    ONC001_S001_QuickCreditCardRequestPage clickChangeApplicationParameters();

    @CustomAction
    default ONC001_S001_QuickCreditCardRequestPage dismissCardApplicationAlert() {
        UfoEndpoint endpoint = getEndpoint(UfoEndpoint.class);
        endpoint.dismissAlert(10);
        return null;
    }

    @Click("ONC001_S001_R001_%s")
    ONC001_S001_QuickCreditCardRequestPage selectOverdraftInsurance(NeedInsurance insurance);

    @Click(value = SEND_BUTTON)
    ONC001_QuickCreditCardRequestTransitionPage clickSendButton();
}
