package cz.moneta.test.regression.commercial.auto.smartauto;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.auto.smartauto.shared.*;
import cz.moneta.test.dsl.util.credentials.Keys;
import cz.moneta.test.dsl.util.task.auto.smartauto.SmartAutoTasks;
import cz.moneta.test.harness.annotations.JiraTestCase;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import cz.moneta.test.harness.support.auth.Credentials;
import cz.moneta.test.harness.support.auth.Key;
import cz.moneta.test.regression.commercial.auto.smartauto.mockdata.CarMock;
import cz.moneta.test.regression.commercial.auto.smartauto.mockdata.SharedMock;
import org.junit.jupiter.api.Disabled;

@Disabled
@TestScenario(name = "Filling Customer businessman.")
public class CustomerBusinessmanTest extends InsuranceAndBenefitData {

    @JiraTestCase(id = "LAMD-T1015")
    @TestCase(name = "Representative: one, Nationality: CZ, Financial information: double entry, Sex: man")
    public void tcCustomerBusinessman1(Harness harness, @Key(Keys.smart.auto.general) Credentials credentials) {
        SmartAutoTasks smartAutoTasks = harness.tasks().auto().smartAuto();

        ContactData contactData = SharedMock.prepareContactDataMan();
        IdentificationData identificationData = SharedMock.prepareIdentificationDataMan();
        CompanyData companyData = SharedMock.prepareCompanyData();
        CalculationData calculationData = CarMock.prepareCalculationCar11();

        harness.withSmartAuto()
                .openLoginPage()
                .then(smartAutoTasks.login().loginWithCredentials(credentials))
                .then(smartAutoTasks.calculationType().makeCalculation(calculationData))
                .then(smartAutoTasks.insuranceTasks().fillCustomerData(calculationData, smartAutoTasks, contactData, identificationData, companyData))
                .then(smartAutoTasks.insuranceTasks().fillInsuranceData(calculationData, smartAutoTasks))
                .then(smartAutoTasks.calculationType().closeInsuranceModal())
                .clickCreateApplication()
                .then(smartAutoTasks.contact().fillCompanyInformation(companyData))
                .then(smartAutoTasks.identification().fillFirstRepresentativeIdentification(contactData, identificationData))
                .then(smartAutoTasks.bankContact().fillBusinessmanBankContact("212345", BankCode.KOMERCNI_BANKA))
                .then(smartAutoTasks.financial().clickDoubleEntry())
                .then(smartAutoTasks.validation().validateCustomerPage());
    }

    @JiraTestCase(id = "LAMD-T1016")
    @TestCase(name = "Representative: one, Nationality: Slovakia, Financial information: tax records, Sex: woman")
    public void tcCustomerBusinessman2(Harness harness, @Key(Keys.smart.auto.general) Credentials credentials) {
        SmartAutoTasks smartAutoTasks = harness.tasks().auto().smartAuto();

        ContactData contactData = SharedMock.prepareContactDataWoman();
        IdentificationData identificationData = SharedMock.prepareIdentificationDataWoman().setNationality(Nationality.SLOVAKIA).setStayType(StayType.PERMANENT);
        CompanyData companyData = SharedMock.prepareCompanyData().setCompany(Company.ELTODO).setIco(Ico.ELTODO);
        CalculationData calculationData = CarMock.prepareCalculationCar11();

        harness.withSmartAuto()
                .openLoginPage()
                .then(smartAutoTasks.login().loginWithCredentials(credentials))
                .then(smartAutoTasks.calculationType().makeCalculation(calculationData))
                .then(smartAutoTasks.insuranceTasks().fillCustomerData(calculationData, smartAutoTasks, contactData, identificationData, companyData))
                .then(smartAutoTasks.insuranceTasks().fillInsuranceData(calculationData, smartAutoTasks))
                .then(smartAutoTasks.calculationType().closeInsuranceModal())
                .clickCreateApplication()
                .then(smartAutoTasks.contact().fillBusinessmanInformation(companyData))
                .then(smartAutoTasks.identification().fillFirstRepresentativeIdentificationNotResident(contactData, identificationData))
                .then(smartAutoTasks.bankContact().fillBusinessmanBankContact("212345", BankCode.KOMERCNI_BANKA))
                .then(smartAutoTasks.financial().clickDoubleEntry())
                .then(smartAutoTasks.validation().validateCustomerPage());
    }

    @JiraTestCase(id = "LAMD-T1017")
    @TestCase(name = "Representative: two, Nationality: CZ, Financial information: tax records, Sex: man")
    public void tcCustomerBusinessman3(Harness harness, @Key(Keys.smart.auto.general) Credentials credentials) {
        SmartAutoTasks smartAutoTasks = harness.tasks().auto().smartAuto();

        ContactData contactData = SharedMock.prepareContactDataMan();
        IdentificationData identificationData = SharedMock.prepareIdentificationDataMan();
        CompanyData companyData = SharedMock.prepareCompanyData();
        CalculationData calculationData = CarMock.prepareCalculationCar11();

        harness.withSmartAuto()
                .openLoginPage()
                .then(smartAutoTasks.login().loginWithCredentials(credentials))
                .then(smartAutoTasks.calculationType().makeCalculation(calculationData))
                .then(smartAutoTasks.insuranceTasks().fillCustomerData(calculationData, smartAutoTasks, contactData, identificationData, companyData))
                .then(smartAutoTasks.insuranceTasks().fillInsuranceData(calculationData, smartAutoTasks))
                .then(smartAutoTasks.calculationType().closeInsuranceModal())
                .clickCreateApplication()
                .then(smartAutoTasks.contact().fillCompanyInformation(companyData))
                .then(smartAutoTasks.identification().fillFirstRepresentativeIdentification(contactData, identificationData))
                .then(smartAutoTasks.financial().clickDoubleEntry())
                .then(smartAutoTasks.validation().validateCustomerPage());
    }
}
