package cz.moneta.test.dsl.hypos.pages.contract;

import cz.moneta.test.dsl.hypos.pages.HyposPageFlow;
import cz.moneta.test.dsl.hypos.pages.hypokalkulacka.HypokalkulackaPage;
import cz.moneta.test.harness.support.web.CheckElementPresent;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.Wait;

import static cz.moneta.test.dsl.hypos.pages.contract.EditContinuePage.ENTER_CONTRACT_BUTTON_XPATH;
import static cz.moneta.test.dsl.hypos.pages.contract.EditContinuePage.PAGE_TITLE_XPATH;

@Wait({PAGE_TITLE_XPATH, ENTER_CONTRACT_BUTTON_XPATH})
public interface EditContinuePage extends HyposPageFlow<EditContinuePage> {
    String PAGE_TITLE_XPATH = "//h1[text()='Oprava / pokračování']";
    String ENTER_CONTRACT_BUTTON_XPATH = "//input[@value='Vstup do obchodu']";
    String ENTER_HYPOKALKULACKA_BUTTON_XPATH = "//input[@id='calc']";
    String CONTRACT_ID_TD = "//table[@class='content']/tbody/tr/th[text()='Obchodní případ č.']//following::td[contains(text(),'%s')]";

    @CheckElementPresent(value = CONTRACT_ID_TD, isStringDynamicXpath = true)
    EditContinuePage checkContractId(String contractId);

    @CheckElementPresent(ENTER_CONTRACT_BUTTON_XPATH)
    EditContinuePage checkEnterContractButtonExistence();

    @Click(ENTER_CONTRACT_BUTTON_XPATH)
    ContractHistoryPage clickEnterContractButton();

    @Click(ENTER_HYPOKALKULACKA_BUTTON_XPATH)
    HypokalkulackaPage clickEnterHypokalkulackaButton();
}
