package cz.moneta.test.dsl.ufo.cb.landing;

import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.ufo.cb.landing.SME401_S001_SearchPage.TYPE_CLIENT_INPUT;

@Wait(value = TYPE_CLIENT_INPUT, until = Until.VISIBLE)
public interface SME401_S001_SearchPage extends WebFlow<SME401_S001_SearchPage> {

    String SEARCH_HISTORY_FIRST_CLIENT_ICO_KEY = "SEARCH_HISTORY_FIRST_CLIENT_ICO";
    String SEARCH_HISTORY_CLIENT_ICO_KEY = "SEARCH_HISTORY_CLIENT_ICO";
    String TYPE_CLIENT_INPUT = "SME401_S001_E001";
    String SEARCH_BUTTON = "SME401_S001_B001";
    String GO_TO_DEAL_CHOICE = "SME401_S001_R001_2";
    String ICO_CHOICE = "SME401_S001_R002_1";
    String NAME_CHOICE = "SME401_S001_R002_2";
    String ACCOUNT_NUMBER_CHOICE = "SME401_S001_R002_3";
    String REG_NUM_CHOICE = "SME401_S001_R002_4";
    String CIF_CHOICE = "SME401_S001_R002_6";
    String ID_CLIENT_CHOICE = "SME401_S001_R002_7";
    String ID_PROPOSAL_CHOICE = "SME401_S001_R002_8";
    String RC_CHOICE = "SME401_S001_R002_5";
    String SEARCH_HISTORY_FIRST_CLIENT_BUTTON = "SME401_S001_G002-0";
    String FIRST_SEARCH_HiSTORY_CLIENT_BY_LEGAL_TYPE_XPATH = "(//td[text()='%s'])[1]/..//button";
    String FIRST_SEARCH_HISTORY_CLIENT_BY_LEGAL_TYPE_ICO_XPATH = "(//td[text()='%s'])[1]/../td[1]";
    String SEARCH_HISTORY_FIRST_CLIENT_ICO_XPATH = "//table[@id='SME401_S001_G002_UfoTable']//tr[1]/td[1]";

    @TypeInto(TYPE_CLIENT_INPUT)
    SME401_S001_SearchPage typeDetailForSearch(String detail);

    @Click(SEARCH_BUTTON)
    IKL402_S001_ClientPage clickSearch();

    @Click(RC_CHOICE)
    SME401_S001_SearchPage pickRc();

    @Click(ICO_CHOICE)
    SME401_S001_SearchPage pickIco();

    @Click(CIF_CHOICE)
    SME401_S001_SearchPage pickCif();

    @Click(ID_PROPOSAL_CHOICE)
    SME401_S001_SearchPage pickProposalId();

    @Click(ACCOUNT_NUMBER_CHOICE)
    SME401_S001_SearchPage pickAccountNumber();

    @Click(ID_CLIENT_CHOICE)
    SME401_S001_SearchPage pickClientId();

    @Click(REG_NUM_CHOICE)
    SME401_S001_SearchPage pickRegNum();

    @Click(SEARCH_HISTORY_FIRST_CLIENT_BUTTON)
    IKL402_S001_ClientPage clickFirstClientInSearchHistory();

    @Click(value = FIRST_SEARCH_HiSTORY_CLIENT_BY_LEGAL_TYPE_XPATH, isStringDynamicXpath = true, by = Lookup.XPATH)
    IKL402_S001_ClientPage clickFirstClientInSearchHistoryByLegalType(String legalType);

    @StoreElementContent(storeKey = SEARCH_HISTORY_FIRST_CLIENT_ICO_KEY, value = SEARCH_HISTORY_FIRST_CLIENT_ICO_XPATH, by = Lookup.XPATH)
    SME401_S001_SearchPage storeSearchHistoryFirstClientIco();

    @StoreElementContent(storeKey = SEARCH_HISTORY_CLIENT_ICO_KEY, value = FIRST_SEARCH_HISTORY_CLIENT_BY_LEGAL_TYPE_ICO_XPATH, by = Lookup.XPATH, isStringDynamicXpath = true)
    SME401_S001_SearchPage storeIcoOfFirstClientInSearchHistoryByLegalType(String legalType);

}
