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

import cz.moneta.test.dsl.ufo.operations.client.clientDetail.STS701_S002_ClientDetailPage;
import cz.moneta.test.harness.context.StoreAccessor;
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.PLK716_S001_CardActivitiesPage.LIST_OF_ACTIVITIES_LABEL;

@Wait(LIST_OF_ACTIVITIES_LABEL)
public interface PLK716_S001_CardActivitiesPage extends WebFlow<PLK716_S001_CardActivitiesPage>, StoreAccessor {

    String CARD_HOLDER_PANEL = "PLK716_S001_L001";
    String BACK_DART_BUTTON = "PLK716_S001_B001";
    String LIST_OF_ACTIVITIES_LABEL = "PLK716_S001_L101";
    String INFORMATION_ABOUT_CARD_HOLDER_LEGEND_XPATH = "//fieldset[@id='PLK716_S001_Y001']/legend";
    String PK_HOLDER_LABEL = "PLK716_S001_L004";
    String CARD_NUMBER_LABEL = "PLK716_S001_L006";
    String GO_BACK_BUTTON = "PLK716_S001_B001";
    String ROW_IN_TABLE_XPATH = "//*[@id='PLK716_S001_G001_UfoTable']/tbody/tr[1]";

    @Wait(value = CARD_HOLDER_PANEL, until = Until.VISIBLE)
    @Click(BACK_DART_BUTTON)
    STS701_S002_ClientDetailPage clickBackButton();

    @Wait(value = INFORMATION_ABOUT_CARD_HOLDER_LEGEND_XPATH, by = Lookup.XPATH, until = Until.VISIBLE)
    @CheckElementContent(value = INFORMATION_ABOUT_CARD_HOLDER_LEGEND_XPATH, by = Lookup.XPATH)
    PLK716_S001_CardActivitiesPage checkInformationAboutCardHolder(String expectedText);

    @Click(value = GO_BACK_BUTTON, andWait = @Wait(value = LOAD_IMG_DIV_CLASS, by = Lookup.CLASSNAME, until = Until.GONE))
    STS701_S002_ClientDetailPage clickBack();

    @Wait(value = ROW_IN_TABLE_XPATH, by = Lookup.XPATH, until = Until.VISIBLE)
    @CheckElementPresent(value = ROW_IN_TABLE_XPATH, by = Lookup.XPATH)
    PLK716_S001_CardActivitiesPage checkListRowInTable();

    @CheckElementContent(CARD_NUMBER_LABEL)
    PLK716_S001_CardActivitiesPage checkCardNumberLabel(String number);

    @Wait(PK_HOLDER_LABEL)
    @CheckElementContent(PK_HOLDER_LABEL)
    PLK716_S001_CardActivitiesPage checkPKHolderLabel(String name);
}