package cz.moneta.test.dsl.ufo.operations.ufoOperations;

import cz.moneta.test.dsl.ufo.operations.shared.SharedElements;
import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.ufo.operations.shared.SharedElements.LOAD_IMG_DIV_CLASS;
import static cz.moneta.test.dsl.ufo.operations.ufoOperations.UKO729_S001_AdministrationPage.ALL_GROUPS_RADIO;

@Wait(value = ALL_GROUPS_RADIO, until = Until.VISIBLE)
@Wait(value = LOAD_IMG_DIV_CLASS, until = Until.GONE, by = Lookup.CLASSNAME)
public interface UKO729_S001_AdministrationPage extends WebFlow<UKO729_S001_AdministrationPage> {

    String ALL_GROUPS_RADIO = "UKO729_S001_R003";
    String USER_BUTTON = "//button[@title='UKO729_S001_I002 [UKO729_S001_I002]']";
    String DETAIL_GROUPS_BUTTON = "//td[text()='Admin úkolovníku']/..//img";
    String USER_AGATA_BUTTON_XPATH = "//div[text()='212627342']/../..//img";
    String SSO_INPUT = "UKO729_S001_E003";
    String SEARCH_SSO_BUTTON = "UKO729_S001_P007";
    String GROUPS_MANAGER_TABLE_XPATH = "//table[@id='UKO729_S001_G002_UfoTable']//td";
    String GROUPS_INCLUDED_TABLE_XPATH = "//table[@id='UKO729_S001_G004_UfoTable']//td";

    @Click(value = ALL_GROUPS_RADIO, jsClick = true)
    UKO729_S001_AdministrationPage clickAllGroups();

    @Click(value = USER_BUTTON, by = Lookup.XPATH)
    UKO729_S001_AdministrationPage clickUser();

    @Click(value = DETAIL_GROUPS_BUTTON, by = Lookup.XPATH)
    UKO729_S001_AdministrationPage clickDetailGroups();

    @Click(value = USER_AGATA_BUTTON_XPATH, by = Lookup.XPATH, andWait = @Wait(value = SharedElements.LOAD_IMG_DIV_CLASS, by = Lookup.CLASSNAME, until = Until.GONE))
    UKO729_S001_AdministrationPage clickUserAgata();

    @TypeInto(value = SSO_INPUT, clear = true)
    UKO729_S001_AdministrationPage fillSso(String sso);

    @Click(value = SEARCH_SSO_BUTTON, andWait = @Wait(value = SharedElements.LOAD_IMG_DIV_CLASS, by = Lookup.CLASSNAME, until = Until.GONE))
    UKO729_S001_AdministrationPage clickSearchSso();

    @CheckElementPresent(value = GROUPS_MANAGER_TABLE_XPATH, by = Lookup.XPATH)
    UKO729_S001_AdministrationPage checkGroupsManagerTableNotEmpty();

    @CheckElementPresent(value = GROUPS_INCLUDED_TABLE_XPATH, by = Lookup.XPATH)
    UKO729_S001_AdministrationPage checkGroupsIncludedTableNotEmpty();

}