package cz.moneta.test.dsl.ib.documents;

import cz.moneta.test.dsl.ib.IbPageFlow;
import cz.moneta.test.dsl.ib.components.MainMenu;
import cz.moneta.test.dsl.ib.components.UserMenu;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.support.web.CheckElementPresent;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.Lookup;
import cz.moneta.test.harness.support.web.Select;
import cz.moneta.test.harness.support.web.TypeInto;
import cz.moneta.test.harness.support.web.Until;
import cz.moneta.test.harness.support.web.Wait;

import static cz.moneta.test.dsl.ib.documents.MyDocumentsPage.PAGE_IDENTIFICATOR;

@Wait(PAGE_IDENTIFICATOR)
public interface MyDocumentsPage extends IbPageFlow<MyDocumentsPage>, MainMenu, UserMenu, StoreAccessor {
    String PAGE_IDENTIFICATOR = "//img[@alt='Obecný frame Moje dokumenty']";
    String DOCUMENT_PRODUCT_XPATH = "//a/b[text()='%s']";
    String FILTER_GROUP = "group";
    String VALUE_DATE_FROM = "valueDateFrom";
    String SHOW_BUTTON = "//img[@alt = 'Zobrazit']";

    @Select(value = FILTER_GROUP, by = Lookup.ID, andWait = @Wait(value = BUSY_LOADER, until = Until.GONE))
    MyDocumentsPage selectGroup(String groupType);

    @TypeInto(value = VALUE_DATE_FROM, by = Lookup.ID)
    MyDocumentsPage setDateFrom(String dateFrom);

    @Click(value = SHOW_BUTTON, andWait = @Wait(value = BUSY_LOADER, until = Until.GONE))
    MyDocumentsPage showDocuments();

    @CheckElementPresent(value = DOCUMENT_PRODUCT_XPATH, isStringDynamicXpath = true)
    MyDocumentsPage checkDocumentName(String documentName);
}