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

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.ufo.operations.client.STO702_S002_ApproveAlreadyReadPage;
import cz.moneta.test.dsl.ufo.operations.client.clientDetail.STS701_S002_ClientDetailPage;
import cz.moneta.test.dsl.ufo.operations.client.NewProductsByNameUfoOps;
import cz.moneta.test.dsl.ufo.operations.client.NewProductsUfoOps;
import cz.moneta.test.dsl.ufo.operations.search.OPS001_S001_ClientSearchPageUfoOperations;
import cz.moneta.test.dsl.ufo.operations.ufoOperations.contactForwarding.XCM701_S001_ContactForwardingPage;

import java.util.function.Function;

public class ClientDetailsTasks {

    private final Harness harness;

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

    public Function<STS701_S002_ClientDetailPage, STO702_S002_ApproveAlreadyReadPage> createNewProduct(NewProductsUfoOps newProduct) {
        return start -> start.selectNewProductForActivation(newProduct)
                .confirmAddProduct();
    }

    public Function<STS701_S002_ClientDetailPage, STO702_S002_ApproveAlreadyReadPage> createNewProductByName(NewProductsByNameUfoOps newProduct) {
        return start -> start.selectNewProductByNameForActivation(newProduct)
                .confirmAddProduct();
    }

    public Function<OPS001_S001_ClientSearchPageUfoOperations, XCM701_S001_ContactForwardingPage> stepsOnContactForwarding(String rcOfExistingClient) {
        return start -> start.then(harness.tasks().ufo().operations().searchClient().byRc(rcOfExistingClient))
                .clickContactForwarding();
    }
}
