package cz.moneta.test.dsl.util.task.ufo.operations;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.ufo.operations.ufoOperations.TRA701_S001_Transactions;

import java.util.function.Function;

public class TransactionsTasks {

    private final Harness harness;

    public TransactionsTasks(Harness harness) {
        this.harness = harness;
    }

    public Function<TRA701_S001_Transactions, TRA701_S001_Transactions> findAndClickLastTransactionDetailAndCheckValue(String expectedValue) {
        return start -> {
            TRA701_S001_Transactions page = start;
            if (!page.getLastRowTransactionDate().equals(page.getActualDate())) {
                page.clickNext();
            }
            return page.checkValueInTransactionTable(expectedValue)
                    .clickLastTransactionDetail();
        };
    }

    public Function<TRA701_S001_Transactions, TRA701_S001_Transactions> comparePostingDateInTransactionDetail() {
        return start ->
                start.checkTransactionDetailPostingDate(start.getActualDate());
    }

}