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

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

public interface PaymentEngineIngoingWaiting extends WebFlow<PaymentEngineIngoingWaiting> {

    String ID = "//input[@name='field1#id']";
    String SEARCH_FIELD = "//button[@class='x-btn-text  grid-filter-collapse']";
    String SEARCH_BTN = "//button[@class='x-btn-text'][text() = 'Hledat']";
    String MANUAL_ACTIONS = "//a[text()= 'Manuální akce']";
    String EDIT_RELEASE = "//input[following-sibling::label[text() = 'Editovat a uvolnit']]";
    String OK_BUTTON = "//button[text() = 'OK']";
    String COVER_ACC_INGOING = "//input[@name = 'orAgentCorrAcc']";
    String CLOSE_TAB_BUTTON = "//a[@class='x-tab-strip-close']";
    String AJAX_LOADING = "//div[text()='Načítám...']";
    String CLEARING_PARTNER = "//input[@name = 'clpIdOr']/following-sibling::img";
    String CLEARING_PARTNER_CERTIS = "//div[@class='x-combo-list-inner']/div[text()='CERTIS-CZK']";

    @Wait(value = AJAX_LOADING, until = Until.GONE)
    @Click(value = SEARCH_FIELD, andWait = @Wait(value = ID, until = Until.VISIBLE))
    PaymentEngineIngoingWaiting clickOnSearchField();

    @TypeInto(ID)
    @Click(value = SEARCH_BTN, andWait = @Wait(value = AJAX_LOADING, until = Until.GONE))
    PaymentEngineIngoingWaiting searchTransaction(String transactionId);

    @Click(value = MANUAL_ACTIONS, andWait = @Wait(value = MANUAL_ACTIONS, until = Until.GONE))
    PaymentEngineIngoingWaiting clickOnManualActions();

    @Click(value = EDIT_RELEASE, andWait = @Wait(value = OK_BUTTON, until = Until.CLICKABLE))
    PaymentEngineIngoingWaiting clickOnEditRelease();

    @TypeInto(COVER_ACC_INGOING)
    PaymentEngineIngoingWaiting fillCoverAccountIngoing(String coverAccIngoing);

    @Click(value = OK_BUTTON, andWait = @Wait(value = OK_BUTTON, until = Until.GONE))
    PaymentEngineIngoingWaiting clickOk();

    @Click(value = CLEARING_PARTNER, andWait = @Wait(value = CLEARING_PARTNER_CERTIS, until = Until.VISIBLE))
    PaymentEngineIngoingWaiting clickOnClearingPartner();

    @Click(value = CLEARING_PARTNER_CERTIS, andWait = @Wait(value = CLEARING_PARTNER_CERTIS, until = Until.GONE))
    PaymentEngineIngoingWaiting chooseClearingPartnerCertis();

    @Click(CLOSE_TAB_BUTTON)
    PaymentEngineHomePage closeTab();
}
