package cz.moneta.test.dsl.ib.settings.ib.ediponents;

import cz.moneta.test.dsl.ib.IbPageFlow;
import cz.moneta.test.dsl.ib.components.MainMenu;
import cz.moneta.test.dsl.ib.settings.ib.SettingsVerticalMenu;
import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.ib.settings.ib.ediponents.CheckSetDiponentPage.CHECK_SET_DISPONENT_TITLE;
import static cz.moneta.test.dsl.ib.settings.ib.ediponents.CheckSetDiponentPage.SET_ACTIVE_DISPONENT_STEP_2;

@Waits({
        @Wait(CHECK_SET_DISPONENT_TITLE),
        @Wait(SET_ACTIVE_DISPONENT_STEP_2)})
public interface CheckSetDiponentPage extends IbPageFlow<CheckSetDiponentPage>, MainMenu, SettingsVerticalMenu {
    String CHECK_SET_DISPONENT_TITLE = "//img[@alt='Nastavení disponenta']";
    String SET_ACTIVE_DISPONENT_STEP_2 = "//img[@src='images_new/top_step2.gif']";
    String SET_PAYMENTS_LIMIT = "//td[text()='Platební limity']//following::input[@value='%s']";
    String SET_RIGHTS_FOR_ACCOUNTS = "//td[text()='Práva pro účty']//following::label[contains(text(),'%s')]";
    String MOBILE_KEY_INPUT = "//td[contains(text(),'Mobilní klíč')]/following::input[@id='SMSCode']";
    String SIGN_SET_ACTIVE_DISPONENT_BUTTON = "//a[@id='sendBtn' and contains(text(),'PODEPSAT')]";

    @CheckElementPresent(value = SET_RIGHTS_FOR_ACCOUNTS, isStringDynamicXpath = true)
    CheckSetDiponentPage checkSetAccountName(String setAccountName);

    @CheckElementPresent(value = SET_PAYMENTS_LIMIT, isStringDynamicXpath = true)
    CheckSetDiponentPage checkPaymentLimit(String paymentLimit);

    @TypeInto(MOBILE_KEY_INPUT)
    CheckSetDiponentPage fillInMobileKey(String mobileKey);

    @Click(SIGN_SET_ACTIVE_DISPONENT_BUTTON)
    ConfirmSetDiponentPage clickSign();
}
