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.dsl.ib.settings.ib.ediponents.activate.RequestActivateDisponentPage;
import cz.moneta.test.dsl.ib.settings.ib.ediponents.deactivate.RequestDeactivateDiponentPage;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.StoreElementContent;
import cz.moneta.test.harness.support.web.Wait;

import static cz.moneta.test.dsl.ib.settings.ib.ediponents.DisponentsOverview.DISPONENTS_OVERVIEW_TITLE;

@Wait(DISPONENTS_OVERVIEW_TITLE)
public interface DisponentsOverview extends IbPageFlow<DisponentsOverview>, MainMenu, SettingsVerticalMenu {
    String DISPONENTS_OVERVIEW_TITLE = "//img[@alt='Přehled disponentů']";
    String CHECK_BOX = "//input[@id='productIdRadio' and @value='%s']";
    String CHANGE_SETTING_BUTTON = "//img[@alt='Změnit nastavení']";
    String DETAIL_BUTTON = "//input[@value='%s']/ancestor::td[@class='listItem']/following-sibling::td/input[@src='images_new/arrow_blue.gif']";
    String DISPONENT_NAME = "//input[@id='productIdRadio' and @value='%s']/parent::td/following-sibling::td";
    String ACTIVATE_EDISPONENT_BUTTON = "//img[@alt='Aktivovat disponenta']";
    String DEACTIVATE_EDISPONENT_BUTTON = "//img[@alt='Deaktivovat disponenta']";
    String ACTIVE_DISPONENT_NAME_KEY = "ACTIVE_DISPONENT_NAME";
    String PASIVE_DISPONENT_NAME_KEY = "PASIVE_DISPONENT_NAME";

    @Click(value = CHECK_BOX, isStringDynamicXpath = true)
    DisponentsOverview chooseDisponent(String username);

    @Click(value = DETAIL_BUTTON, isStringDynamicXpath = true)
    DetailDisponentPage clickToDetail(String username);

    @Click(value = CHANGE_SETTING_BUTTON)
    RequestSetDiponentPage clickToChangeSettings();

    @StoreElementContent(storeKey = ACTIVE_DISPONENT_NAME_KEY, value = DISPONENT_NAME, isStringDynamicXpath = true)
    DisponentsOverview getActiveDisponentName(String activeDispoUserName);

    @StoreElementContent(storeKey = PASIVE_DISPONENT_NAME_KEY, value = DISPONENT_NAME, isStringDynamicXpath = true)
    DisponentsOverview getPasiveDisponentName(String pasiveDispoUserName);

    @Click(DEACTIVATE_EDISPONENT_BUTTON)
    RequestDeactivateDiponentPage clickDeactiveDisponentButton();

    @Click(ACTIVATE_EDISPONENT_BUTTON)
    RequestActivateDisponentPage clickActivateDisponentButton();
}
