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

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

import java.util.function.Function;

public class InvoicesTasks {

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

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

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

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