package cz.moneta.test.dsl.ufo.banka.pages.products.sme;

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

import static cz.moneta.test.dsl.ufo.banka.pages.products.sme.KUL001_S001_SelectProductsPage.KUL001_S001_PAGE_LABEL_XPATH;
import static cz.moneta.test.dsl.ufo.banka.pages.products.sme.KUL001_S001_SelectProductsPage.TABLE_NEW_PRODUCT;

@Wait(value = KUL001_S001_PAGE_LABEL_XPATH, by = Lookup.XPATH, waitSecondsForElement = 60)
@Wait(value = TABLE_NEW_PRODUCT, by = Lookup.XPATH)
public interface KUL001_S001_SelectProductsPage extends WebFlow<KUL001_S001_SelectProductsPage> {
    String KUL001_S001_PAGE_LABEL_XPATH = "//div[text()='KUL001_S001']";

    String CONTINUE_BUTTON = "KUL001_S001_B001";
    String ADD_NEW_PRODUCT_BUTTON = "KUL001_S001_B004";
    String PRODUCT_TO_ONBOARD_XPATH = "//td[@class='ufo-Table-BodyCell' and contains(text(),'%s')]";

    String TABLE_NEW_PRODUCT = "//table[@id='KUL001_S001_G001_UfoTable']//th[text()='Produkt']";
    String PRODUCT_GENERAL_INPUT_XPATH = "//*[text()='%s']";
    String LOADER_XPATH = "//div[@class=\"gwt-PopupPanel\"]";

    @Click(value = PRODUCT_GENERAL_INPUT_XPATH, isStringDynamicXpath = true, by = Lookup.XPATH, andWait = @Wait(value = LOADER_XPATH, by = Lookup.XPATH, until = Until.GONE))
    @Click(ADD_NEW_PRODUCT_BUTTON)
    KUL002_S001_ProductDetailPage selectExpresBusiness(String expresBusiness);

    @Click(value = PRODUCT_GENERAL_INPUT_XPATH, isStringDynamicXpath = true, by = Lookup.XPATH, andWait = @Wait(value = LOADER_XPATH, by = Lookup.XPATH, until = Until.GONE))
    @Click(ADD_NEW_PRODUCT_BUTTON)
    KUL003_S001_FlexiBusinessProductDetail selectFlexiBusiness(String flexiBusiness);

    @Click(value = PRODUCT_TO_ONBOARD_XPATH, isStringDynamicXpath = true, by = Lookup.XPATH, andWait = @Wait(value = LOADER_XPATH, by = Lookup.XPATH, until = Until.GONE))
    KUL001_S001_SelectProductsPage selectProductToOnboard(String productToOnboard);

    @Click(ADD_NEW_PRODUCT_BUTTON)
    KUL001_S001_SelectProductsPageTransitions clickAddProduct();

    @Click(CONTINUE_BUTTON)
    KUL001_S001_SelectProductsPageTransitions clickContinue();
}
