package cz.moneta.test.dsl.cashman.pages.menu_OM;

import cz.moneta.test.dsl.cashman.pages.CashmanHomePage;
import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.cashman.pages.menu_OM.CashmanOMCzkPragueList.FILTER_POPOVER;

@Wait(FILTER_POPOVER)
public interface CashmanOMCzkPragueList extends WebFlow<CashmanOMCzkPragueList> {
    String FILTER_POPOVER = "//a[@id='popoverTrig']";
    String WAITING_FLAG_CHECKBOX = "//input[@name='waitingFlag']";
    String DATE_FROM_INPUT = "//input[@name='modifiedDateFrom']";
    String ORDER_ID_INPUT = "//input[@name='realId']";
    String SUBMIT_FILTER = "//button[@name='filter']";
    String ORDER_ID_TABLE = "//tbody//a[contains(text(), '%s')]";
    String ORDER_STATUS_TABLE = "//tbody//span[contains(text(), '%s')]";
    String FILTERED_SPAN = "//span[contains(text(), 'Filtrování objednávek je aktivní.')]";
    String HOME_PAGE = "//a[@href='/domu']";

    @Click(FILTER_POPOVER)
    CashmanOMCzkPragueList clickOnFilter();

    @TypeInto(ORDER_ID_INPUT)
    CashmanOMCzkPragueList fillOrderId(String orderId);

    @Click(WAITING_FLAG_CHECKBOX)
    CashmanOMCzkPragueList clickOnWaitingFlag();

    @TypeInto(DATE_FROM_INPUT)
    @KeyPress(Key.ENTER)
    CashmanOMCzkPragueList fillDateFrom(String date);

    @Click(SUBMIT_FILTER)
    CashmanOMCzkPragueList submitFilter();

    @Wait(value = ORDER_ID_TABLE, isStringDynamicXpath = true)
    CashmanOMCzkPragueList waitForOrderIdPresence(String orderId);

    @CheckElementPresent(value = ORDER_STATUS_TABLE, isStringDynamicXpath = true)
    CashmanOMCzkPragueList checkOrderStatus(String orderStatus);

    @Click(HOME_PAGE)
    CashmanHomePage clickOnHomePage();
}
