package cz.moneta.test.dsl.util.task.ib;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.ib.settings.ib.contactInformation.IbContactInformationPage;
import cz.moneta.test.dsl.ib.settings.ib.contactInformation.IbSignChangedContactDataPage;
import cz.moneta.test.dsl.util.data.client.NewClient;

import java.util.function.Function;

public final class IbContactDataTasks {
    private final Harness harness;

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

    public Function<IbContactInformationPage, IbContactInformationPage> verifyContactData(NewClient newClient) {
        return start -> start
                .switchToFrame()
                .checkFirstName(newClient.getClientData().firstName())
                .checkSecondName(newClient.getClientData().lastName())
                .checkStreet(newClient.getClientData().residencyAddress().getStreet() + " " + newClient.getClientData().residencyAddress().getDescriptiveNumber())
                .checkPostalCode(newClient.getClientData().residencyAddress().getZip())
                .checkTown(newClient.getClientData().residencyAddress().getCity())
                .checkCountryCode(newClient.getClientData().residencyAddress().getCountry())
                .checkMobileNumber(newClient.getClientData().mobileNumber())
                .checkEmail(newClient.getClientData().email());
    }

    public Function<IbSignChangedContactDataPage, IbSignChangedContactDataPage> verifyContactDataOnSignPage(String firstName, String lastName, String street, String descriptiveNumber, String zip, String city, String mobileNumber, String email) {
        return start -> start
                .checkFirstName(firstName)
                .checkLastName(lastName)
                .checkStreet(street)
                .checkDescriptiveNumber(descriptiveNumber)
                .checkPostalCode(zip)
                .checkCity(city)
                .checkMobileNumber(mobileNumber)
                .checkEmail(email);
    }
}
