package cz.moneta.test.dsl.util.task.auto.smartauto.df.login;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.auto.smartauto.LoginPage;
import cz.moneta.test.dsl.auto.smartauto.df.DashboardPage;
import cz.moneta.test.dsl.util.task.auto.smartauto.SmartAutoTasks;
import cz.moneta.test.harness.support.auth.Credentials;

import java.util.function.Function;

public class LoginTasks {

    private final Harness harness;

    private SmartAutoTasks smartAutoTasks;

    public LoginTasks(Harness harness) {
        this.harness = harness;
        this.smartAutoTasks = harness.tasks().auto().smartAuto();
    }

    public Function<LoginPage, DashboardPage> loginWithCredentials(Credentials credentials) {
        return start -> start.then(smartAutoTasks.login().loginWithCredentials(credentials))
                .clickOperatorOptions()
                .clickDealerFinancing();
    }
}