package cz.moneta.test.dsl.payment_engine.parts_of_menu.menu_search;


import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.payment_engine.home.PaymentEngineHomePage;
import cz.moneta.test.dsl.payment_engine.utils.PaymentEngineUtils;
import cz.moneta.test.harness.support.web.*;

public interface PaymentEngineSearchTransactionDetail extends WebFlow<PaymentEngineSearchTransactionDetail> {
    String RECORD_DETAIL = "//div[contains(@class,'x-hide-offsets')][last()]/following-sibling::div//a[text() = 'Detail záznamu']";
    String LIFE_CYCLE = "//div[contains(@class,'x-hide-offsets')][last()]/following-sibling::div//a[text() = 'Životní cyklus']";
    String REF_TRANSACTION_KEY = "REF_TRANSACTION_KEY";
    String REF_TRANSACTION_XPATH = "//div[contains(@class,'x-hide-offsets')][last()]/following-sibling::div//input[@name = 'txRef']";
    String CLOSE_TAB = "//a[@class='x-tab-strip-close']";

    @Click(RECORD_DETAIL)
    PaymentEngineSearchTransactionRecordDetail clickOnRecordDetail();

    @Click(LIFE_CYCLE)
    PaymentEngineSearchTransactionDetailLifeCycle clickOnLifeCycle();

    @CustomAction
    default PaymentEngineSearchTransactionDetail storeRefTransaction(Harness harness) {
        PaymentEngineUtils.storeElementAttribute(harness, REF_TRANSACTION_XPATH, REF_TRANSACTION_KEY);
        return null;
    }

    @Click(CLOSE_TAB)
    PaymentEngineHomePage closeTab();
}
