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

import cz.moneta.test.dsl.auto.smartauto.shared.*;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.support.web.*;

public interface SavedCalculationsPage extends SmartAutoFlow<SavedCalculationsPage>, StoreAccessor, CalendarAccessor {

    String HEADING_SAVED_CALCULATIONS = "//h1[contains(text(), 'Kalkulace')]";
    String FIRST_APPLICATION_DIV = "//h2/span[contains(text(), 'Dnes')]/../../div[1]";
    String CALCULATION_NAME = FIRST_APPLICATION_DIV + "/div/div/div/div[contains(text(), 'TestDuplikace')]";
    String CALCULATION_STATUS = FIRST_APPLICATION_DIV + "//span[contains(text(), 'Rozpracovaná žádost')]";
    String CALCULATION_DATE = FIRST_APPLICATION_DIV + "/div/div/div[3]/div[2]";
    String DATE_FROM = "//label[contains(., 'Datum od')]/following-sibling::div/button";
    String DATE_TO = "//label[contains(., 'Datum do')]/following-sibling::div/button";
    String SEARCH_BUTTON = "//button[@testid='bbutton' and span[text()='Zobrazit']]";
    String FROM_DATE_YEAR_FIELD_ARROWDOWN = "(//span[@class='arrowDown'])[1]";
    String SAVED_ITEM = "(//div[contains(@class, 'calculation-item-scbBC')])[1]";

    @CheckElementPresent(HEADING_SAVED_CALCULATIONS)
    SavedCalculationsPage checkSavedCalculationHeading();

    @CheckElementContent(CALCULATION_NAME)
    SavedCalculationsPage checkForCalculationTitle(String title);

    @CheckElementContent(CALCULATION_DATE)
    SavedCalculationsPage checkForCalculationDate(String date);

    @CheckElementPresent(CALCULATION_STATUS)
    SavedCalculationsPage checkForCalculationStatus();

    @Click(DATE_FROM)
    SavedCalculationsPage clickDateFrom();

    @Click(DATE_TO)
    SavedCalculationsPage clickDateTo();

    @Click(DATE_FROM_MONTH)
    SavedCalculationsPage clickDateFromMonth();

    @Click(DATE_TO_MONTH)
    SavedCalculationsPage clickDateToMonth();

    @Click(DATE_FROM_MONTH_DEFAULT)
    SavedCalculationsPage clickDateFromMonthValue(Month month);

    @Click(DATE_TO_MONTH_DEFAULT)
    SavedCalculationsPage clickDateToMonthValue(Month month);

    @Click(DATE_FROM_DAY_DEFAULT)
    SavedCalculationsPage clickDateFromDayValue(Day day);

    @Click(DATE_TO_DAY_DEFAULT)
    SavedCalculationsPage clickDateToDayValue(Day day);

    @Click(FROM_DATE_YEAR_FIELD_ARROWDOWN)
    SavedCalculationsPage setDateFromYear(Year year);

    @Click(SEARCH_BUTTON)
    SavedCalculationsPage clickSearch();

    @Wait(value = SAVED_ITEM, explicitWaitSeconds = 1)
    @CheckElementPresent(SAVED_ITEM)
    SavedCalculationsPage checkSavedItem();
}