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

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.ufo.operations.client.clientDetail.STS701_S002_ClientDetailPage;
import cz.moneta.test.dsl.ufo.operations.search.OPS001_S001_ClientSearchPageUfoOperations;
import cz.moneta.test.dsl.ufo.operations.ufoOperations.PSP701_S001_AmortizationPage;
import cz.moneta.test.dsl.ufo.operations.ufoOperations.TRA701_S001_Transactions;

import java.util.function.Function;

public class CurrentAccountTasks {

    private final Harness harness;

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

    public Function<OPS001_S001_ClientSearchPageUfoOperations, TRA701_S001_Transactions> stepsToFirstAccountStatement(String rc) {
        return start -> start.fillSearchInput(rc)
                .clickSearchClient()
                .onClientDetailsPage()
                .clickAccountList()
                .selectFirstCurrentAccCombobox(1)
                .checkAccountState("Otevřený")
                .clickTransactions()
                .clickFirstAccountStatementCheckbox();
    }

    public Function<PSP701_S001_AmortizationPage, STS701_S002_ClientDetailPage> checkIbSbCheckboxAndCheckRequirement(){
        return start -> start.checkIfIBSBIsChecked()
                .clickSendButton()
                .onTransactionsPage()
                .clickBack()
                .menuClickClientRequirements()
                .clickRefreshRequirements()
                .assertFirstRequirementDescription("UFO - Bězný účet - Výpisy - Zaslání přes KC")
                .clickRefreshClientButton();
    }
}
