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

import cz.moneta.test.dsl.ufo.operations.client.clientDetail.STS701_S002_ClientDetailPage;
import cz.moneta.test.dsl.ufo.operations.shared.topmenu.XXX702_SharedTopMenu;
import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.ufo.operations.client.ApplicationListPage.LOAD_ALL_BUTTON;
import static cz.moneta.test.dsl.ufo.operations.shared.SharedElements.LOAD_IMG_DIV_CLASS;

@Wait(LOAD_ALL_BUTTON)
public interface ApplicationListPage extends WebFlow<ApplicationListPage>, XXX702_SharedTopMenu<ApplicationListPage> {
    String LOAD_ALL_BUTTON = "XXX702_T001_B027";
    String DETAIL_BUTTON = "XXX702_T001_P045-1";
    String LOAD_BUTTON = "XXX702_T001_B026";
    String COPY_BUTTON = "XXX702_T001_B034";
    String FINISH_BUTTON = "XXX702_T001_B029";
    String DECISION_BUTTON = "XXX702_T001_B030";
    String STORNO_BUTTON = "XXX702_T001_B028";
    String CLIENT_DETAIL = "//button [contains(@title, '[XXX702_T001_I006]')]";

    @CheckElementContent("XXX702_T001_L303-1")
    ApplicationListPage assertFirstApplicationProductType(String firstApplicationProductType);

    @CheckElementContent("XXX702_T001_L305-1")
    ApplicationListPage assertFirstApplicationRequestedAmount(String firstApplicationRequestedAmount);

    @CheckElementContent("XXX702_T001_L306-1")
    ApplicationListPage assertFirstApplicationApprovedAmount(String firstApplicationApprovedAmount);

    @Wait(explicitWaitSeconds = 1) // There is a moment when list is full of some random items, can't think of better way to track it
    @CheckElementContent("XXX702_T001_L285-1")
    ApplicationListPage assertFirstApplicationState(String firstApplicationState);

    @CheckElementContent("XXX702_T001_L310-1")
    ApplicationListPage assertFirstApplicationChannel(String channel);

    @CheckElementPresent(DETAIL_BUTTON)
    ApplicationListPage assertApplicationDetailButton();

    @CheckElementPresent(LOAD_BUTTON)
    ApplicationListPage assertApplicationLoadButton();

    @CheckElementPresent(LOAD_ALL_BUTTON)
    ApplicationListPage assertApplicationLoadAllButton();

    @CheckElementPresent(COPY_BUTTON)
    ApplicationListPage assertApplicationCopyButton();

    @CheckElementPresent(FINISH_BUTTON)
    ApplicationListPage assertApplicationFinishButton();

    @CheckElementPresent(DECISION_BUTTON)
    ApplicationListPage assertApplicationDecisionButton();

    @CheckElementPresent(STORNO_BUTTON)
    ApplicationListPage assertApplicationStornoButton();

    @Wait(value = LOAD_IMG_DIV_CLASS, until = Until.GONE, by = Lookup.CLASSNAME)
    @Click(value = CLIENT_DETAIL, by = Lookup.XPATH)
    STS701_S002_ClientDetailPage clickClientDetail();

}
