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

import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.ufo.banka.pages.cards.credit.NKK001_S007_QuickCreditCardApplicantDetailsPage.CONTINUE_BUTTON;
import static cz.moneta.test.dsl.ufo.banka.pages.cards.credit.NKK001_S007_QuickCreditCardApplicantDetailsPage.PAGE_ID_XPATH;
import static cz.moneta.test.dsl.ufo.banka.pages.cards.credit.NKK001_S007_QuickCreditCardApplicantDetailsPage.PRODUCT_TYPE_SELECT;
import static cz.moneta.test.dsl.ufo.operations.shared.SharedElements.LOAD_IMG_DIV_CLASS;

@Wait(value = PAGE_ID_XPATH, by = Lookup.XPATH, waitSecondsForElement = 40)
@Wait({PRODUCT_TYPE_SELECT, CONTINUE_BUTTON})
public interface NKK001_S007_QuickCreditCardApplicantDetailsPage extends WebFlow<NKK001_S007_QuickCreditCardApplicantDetailsPage> {

    String PAGE_ID_XPATH = "//div[text()='NKK001_S007']";
    String CONTINUE_BUTTON = "NKK001_S007_B008";
    String PRODUCT_TYPE_SELECT = "NKK001_S007_C004";
    String CARD_BRAND_SELECT = "NKK001_S007_C011";
    String PROMO_SELECT = "NKK001_S007_C012";
    String CARD_TYPE_SELECT = "NKK001_S007_C005";

    @Select(value = PRODUCT_TYPE_SELECT, andWait = @Wait(value = LOAD_IMG_DIV_CLASS, until = Until.GONE, by = Lookup.CLASSNAME))
    NKK001_S007_QuickCreditCardApplicantDetailsPage selectProductType(ProductType productType);

    @Select(CARD_TYPE_SELECT)
    NKK001_S007_QuickCreditCardApplicantDetailsPage selectCardType(CardType cardType);

    @Select(CARD_BRAND_SELECT)
    NKK001_S007_QuickCreditCardApplicantDetailsPage selectCardBrand(CardBrand cardBrand);

    @Select(value = PROMO_SELECT, andWait = @Wait(value = LOAD_IMG_DIV_CLASS, until = Until.GONE, by = Lookup.CLASSNAME))
    NKK001_S007_QuickCreditCardApplicantDetailsPage selectPromo(CreditCardsPromo promo);

    @TypeInto(value = "NKK001_S007_E024", clear = true, andWait = @Wait(value = LOAD_IMG_DIV_CLASS, until = Until.GONE, by = Lookup.CLASSNAME))
    NKK001_S007_QuickCreditCardApplicantDetailsPage setRequestedLimit(String limit);

    @CheckElementContent(PROMO_SELECT)
    NKK001_S007_QuickCreditCardApplicantDetailsPage assertPromo(CreditCardsPromo promo);

    @CheckElementContent(value = "//input[@name='NKK001_S007_E024']", by = Lookup.XPATH)
    NKK001_S007_QuickCreditCardApplicantDetailsPage assertRequestedLimit(String limit);

    @Wait(CONTINUE_BUTTON)
    @Click(CONTINUE_BUTTON)
    NKK001_S007_QuickCreditCardApplicantInfoPage clickContinueButton();

    @Select(value = CARD_BRAND_SELECT, selectByOrder = true)
    NKK001_S007_QuickCreditCardApplicantDetailsPage selectCardBrandByIndex(int index);
}
