package cz.moneta.test.dsl.util.task.auto.smartauto.savedCalculations;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.auto.smartauto.SavedCalculationsPage;
import cz.moneta.test.dsl.auto.smartauto.shared.DateData;

import java.util.function.Function;

public class SavedCalculationsTasks {

    private final Harness harness;
    public SavedCalculationsTasks(Harness harness) {
        this.harness = harness;
    }

    public Function<SavedCalculationsPage, SavedCalculationsPage> setFromDate(DateData date) {
        return start -> start
                .clickDateFrom()
                .setDateFromYear(date.year())
                .clickDateFromMonth()
                .clickDateFromMonthValue(date.month())
                .clickDateFromDayValue(date.day());

    }

    public Function<SavedCalculationsPage, SavedCalculationsPage> setToDate(DateData date) {
        return start -> start
                .clickDateTo()
                .clickDateToMonth()
                .clickDateToMonthValue(date.month())
                .clickDateToDayValue(date.day());
    }

    public Function<SavedCalculationsPage, SavedCalculationsPage> search() {
        return SavedCalculationsPage::clickSearch;
    }

    public Function<SavedCalculationsPage, SavedCalculationsPage> checkSavedItem() {
        return SavedCalculationsPage::checkSavedItem;
    }
}
