package cz.moneta.test.dsl.ufo.banka.pages.main;

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

import static cz.moneta.test.dsl.ufo.banka.pages.main.INK001_S002_ListOfAuthorizationForDirectDebitsPage.INK001_S002_PAGE_LABEL_XPATH;
import static cz.moneta.test.dsl.ufo.operations.shared.SharedElements.LOAD_IMG_DIV_CLASS;

@Wait(value = INK001_S002_PAGE_LABEL_XPATH, by = Lookup.XPATH)
@Wait(value = INK001_S002_ListOfAuthorizationForDirectDebitsPage.CREATE_BUTTON, waitSecondsForElement = 90)
public interface INK001_S002_ListOfAuthorizationForDirectDebitsPage extends WebFlow<INK001_S002_ListOfAuthorizationForDirectDebitsPage> {

    String INK001_S002_PAGE_LABEL_XPATH = "//div[text()='INK001_S002']";
    String CREATE_BUTTON = "INK001_S002_B003";
    String CHANGE_BUTTON = "INK001_S002_B004";
    String DELETE_BUTTON = "INK001_S002_B005";
    String AUTHORIZATION_FOR_DIRECT_DEBIT_ID_XPATH = "//td[text()='%s']";
    String AUTHORIZATION_FOR_DIRECT_DEBIT_STATUS_VALID_XPATH = "//td[text()='%s']//following-sibling::td[text()='Platné']";
    String AUTHORIZATION_FOR_DIRECT_DEBIT_STATUS_DELETED_XPATH = "//td[text()='%s']//following-sibling::td[text()='Zrušené']";
    String FIRST_DIRECT_DEBIT_RADIO = "INK001_S002_G001-0";
    String DIRECT_DEBIT_TITLE_XPATH = "//table[@id='INK001_S002_G001_UfoTable']//td[3]";
    String DIRECT_DEBIT_AMOUNT_XPATH = "//table[@id='INK001_S002_G001_UfoTable']//td[6]";

    @Click(CREATE_BUTTON)
    INK001_S004_CreateNewDirectDebitPage clickCreateButton();

    @Click(CHANGE_BUTTON)
    INK001_S009_ChangeAuthorizationForDirectDebitPage clickChange();

    @Click(DELETE_BUTTON)
    INK001_S014_DeleteAuthorizationForDirectDebitPage clickDelete();

    @CheckElementPresent(value = AUTHORIZATION_FOR_DIRECT_DEBIT_STATUS_VALID_XPATH, isStringDynamicXpath = true, by = Lookup.XPATH)
    INK001_S002_ListOfAuthorizationForDirectDebitsPage checkAuthorizationForDirectDebitValid(String authorizationForDirectDebitId);

    @CheckElementPresent(value = AUTHORIZATION_FOR_DIRECT_DEBIT_STATUS_DELETED_XPATH, isStringDynamicXpath = true, by = Lookup.XPATH)
    INK001_S002_ListOfAuthorizationForDirectDebitsPage checkAuthorizationForDirectDebitDeletd(String authorizationForDirectDebitId);

    @Click(value = AUTHORIZATION_FOR_DIRECT_DEBIT_ID_XPATH, isStringDynamicXpath = true, by = Lookup.XPATH,
            andWait = @Wait(value = LOAD_IMG_DIV_CLASS, by = Lookup.CLASSNAME, until = Until.GONE))
    INK001_S002_ListOfAuthorizationForDirectDebitsPage clickOnAuthorizationForDirectDebit(String authorizationForDirectDebitId);

    @Click(FIRST_DIRECT_DEBIT_RADIO)
    INK001_S002_ListOfAuthorizationForDirectDebitsPage clickFirstDirectDebit();

    @CheckElementContent(value = DIRECT_DEBIT_TITLE_XPATH, by = Lookup.XPATH, isStringDynamicXpath = true)
    INK001_S002_ListOfAuthorizationForDirectDebitsPage checkDirectDebitTitle(String directDebitId, String directDebitTitle);

    @CheckElementContent(value = DIRECT_DEBIT_AMOUNT_XPATH, by = Lookup.XPATH, isStringDynamicXpath = true)
    INK001_S002_ListOfAuthorizationForDirectDebitsPage checkDirectDebitAmount(String directDebitId, String directDebitAmount);


}
