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

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

import static cz.moneta.test.dsl.payment_engine.parts_of_menu.menu_transaction.PaymentEngineOutgoingManual.FIRST_ROW;

@Wait(FIRST_ROW)
public interface PaymentEngineOutgoingManual extends WebFlow<PaymentEngineOutgoingManual> {
    String PREFIX = "//div[@id='Odchozí / Manuální']";
    String FIRST_ROW = PREFIX + "//div[contains(@class, 'x-grid3-row-selected')]";
    String ID = PREFIX + "//input[@name = 'field1#id']";
    String SEARCH_BUTTON = PREFIX + "//button[text() = 'Hledat']";
    String FILTER_BUTTON = PREFIX + "//button[@class='x-btn-text  grid-filter-collapse']";
    String MANUAL_ACTIONS = PREFIX + "//a[text()= 'Manuální akce']";
    String TRANSACTION_ROW = PREFIX + "//div[@class = 'x-grid3-cell-inner x-grid3-col-2'][text() = '%s']";

    @Wait(explicitWaitSeconds = 2)
    @Click(FILTER_BUTTON)
    PaymentEngineOutgoingManual clickOnFilterButton();

    @TypeInto(ID)
    PaymentEngineOutgoingManual fillTransactionId(String transactionId);

    @Click(value = SEARCH_BUTTON, andWait = @Wait(value = TRANSACTION_ROW, isStringDynamicXpath = true))
    PaymentEngineOutgoingManual clickOnSearchButtonAndWaitForResult(String transactionId);

    @Wait(explicitWaitSeconds = 2)
    @Click(value = MANUAL_ACTIONS, andWait = @Wait(value = MANUAL_ACTIONS, until = Until.GONE))
    PaymentEngineOutgoingManualEdit clickOnManualActions();
}
