package cz.moneta.test.dsl.auto.smartauto.cr;

import cz.moneta.test.dsl.auto.smartauto.SmartAutoFlow;
import cz.moneta.test.harness.support.web.CheckElementPresent;
import cz.moneta.test.harness.support.web.CheckElementsPresent;
import cz.moneta.test.harness.support.web.Wait;

import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.ACTIVE_FILTERS_BUTTON;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.COLUMNS_BUTTON;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.CR_MENU_COMMISSIONS;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.CR_MENU_CREDIT_NOTES;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.CR_MENU_FOR_BILLING;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.CR_MENU_INVOICES;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.EXPORT_BUTTON;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.NEXT_PAGE_BUTTON;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.PREVIOUS_PAGE_BUTTON;
import static cz.moneta.test.dsl.auto.smartauto.shared.CommonElements.SORT_ACTIVITY_BUTTON;

@Wait(value = {CR_MENU_FOR_BILLING, CR_MENU_INVOICES, CR_MENU_COMMISSIONS, CR_MENU_CREDIT_NOTES}, waitSecondsForElement = 40)
public interface ForBillingPage extends SmartAutoFlow<ForBillingPage> {

    String PARTNER_TEXT = "//span[contains(text(), 'Partner')]";
    String FROM_DATE_TEXT = "//span[contains(text(), 'Od data')]";
    String TO_DATE_TEXT = "//span[contains(text(), 'Do data')]";
    String COMMISSIONS_CREDIT_NOTES_TEXT = "//span[contains(text(), 'Provize/Dobropis')]";
    String FILTER_TITLE = "//h6[contains(text(), 'Filtr')]";
    String BILLING_COMMISSIONS_TITLE = "//h6[contains(text(), 'Fakturace')]";
    String RESET_BUTTON = "//span[contains(text(), 'Resetovat')]";
    String SEARCH_BUTTON = "//span[contains(text(), 'Vyhledat')]";
    String INVOICE_BUTTON = "//span[contains(text(), 'Vyfakturovat')]";

    @CheckElementsPresent(value = {
            @CheckElementPresent(PARTNER_TEXT),
            @CheckElementPresent(FROM_DATE_TEXT),
            @CheckElementPresent(TO_DATE_TEXT),
            @CheckElementPresent(COMMISSIONS_CREDIT_NOTES_TEXT)})
    ForBillingPage checkForBillingTexts();

    @CheckElementsPresent(value = {@CheckElementPresent(FILTER_TITLE), @CheckElementPresent(BILLING_COMMISSIONS_TITLE)})
    ForBillingPage checkForBillingTitles();

    @CheckElementsPresent(value = {
            @CheckElementPresent(RESET_BUTTON),
            @CheckElementPresent(SEARCH_BUTTON),
            @CheckElementPresent(INVOICE_BUTTON),
            @CheckElementPresent(ACTIVE_FILTERS_BUTTON),
            @CheckElementPresent(SORT_ACTIVITY_BUTTON),
            @CheckElementPresent(COLUMNS_BUTTON),
            @CheckElementPresent(EXPORT_BUTTON),
            @CheckElementPresent(PREVIOUS_PAGE_BUTTON),
            @CheckElementPresent(NEXT_PAGE_BUTTON)})
    ForBillingPage checkForBillingButtons();
}