package cz.moneta.test.dsl.util.task.auto.smartauto.customer;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.auto.smartauto.CustomerPage;
import cz.moneta.test.dsl.auto.smartauto.shared.CompanyData;

import java.util.function.Function;

public class CompanyTasks {

    private final Harness harness;

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

    public Function<CustomerPage, CustomerPage> fillCompanyRegistered(CompanyData companyData) {
        return start -> start.typeCompany(companyData.getCompany())
                .clickSearchInAres()
                .chooseCompany(companyData.getCompany())
                .typeCompanyContactAddress(companyData.getCompanyContactAddress().getValue())
                .typeCompanyPhoneNumber(companyData.getCompanyPhoneNumber())
                .typeCompanyOtherPhoneNumber(companyData.getCompanyOtherPhoneNumber())
                .typeCompanyEmail(companyData.getCompanyEmail());
    }

    public Function<CustomerPage, CustomerPage> fillCompanyNotRegistered(CompanyData companyData) {
        return start -> start.clickCompanyNotRegistered()
                .typeCompanyName(companyData.getCompanyName())
                .typeCompanyStree(companyData.getCompanyStreet())
                .typeCompanyResidenceNumber(companyData.getCompanyResidenceNumber())
                .typeCompanyOrientationNumber(companyData.getCompanyOrientationNumber())
                .typeCompanyZipCode(companyData.getCompanyZipCode())
                .typeCompanyCity(companyData.getCompanyCity())
                .clickCompanyCountry()
                .chooseCompanyCountry(companyData.getCompanyCountry())
                .typeCompanyPhoneNumber(companyData.getCompanyPhoneNumber())
                .typeCompanyOtherPhoneNumber(companyData.getCompanyOtherPhoneNumber())
                .typeCompanyEmail(companyData.getCompanyEmail());
    }
}
