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.smart;
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.*;
import org.junit.jupiter.api.Disabled;

@Disabled
@TestScenario(name = "Successful filled new calculation for Agro.")
public class CalculationAgroWithoutTPTest {

    @JiraTestCase(id = "LAMD-T1360")
    @TestCase(name = "Customer : Businessman_with_vat | State : New | Vat : Yes | Agro : Not registered | Donation : Young farmer")
    public void tcCalculationAgroNoTP1(Harness harness, @Key(smart.auto.general) Credentials credentials) {
        CalculationData calculationData = AgroMock.prepareCalculationAgroNoTP1();
        CompanyData companyData = SharedMock.prepareCompanyData();
        ContactData contactData = SharedMock.prepareContactDataMan();
        IdentificationData identificationData = SharedMock.prepareIdentificationDataMan();
        SmartAutoTasks smartAutoTasks = harness.tasks().auto().smartAuto();

        harness.withSmartAuto()
                .openLoginPage()
                .then(smartAutoTasks.login().loginWithCredentials(credentials))
                .then(smartAutoTasks.calculationType().makeCalculationAgroWithoutTP(calculationData))
                .then(smartAutoTasks.insuranceTasks().fillCustomerData(calculationData, smartAutoTasks, contactData, identificationData, companyData))
                .then(smartAutoTasks.insuranceTasks().fillInsuranceData(calculationData, smartAutoTasks))
                .then(smartAutoTasks.calculationType().closeInsuranceModal())
                .then(smartAutoTasks.verification().checkNewCalculation());
    }

    @JiraTestCase(id = "LAMD-T1513")
    @TestCase(name = "Deferred drawing | Customer : Businessman_without_vat | State : New | Vat : Yes | Agro : Not registered | Donation : Young farmer")
    public void tcCalculationAgroNoTP2(Harness harness, @Key(smart.auto.general) Credentials credentials) {
        CalculationData calculationData = AgroMock.prepareCalculationAgroNoTP2();
        CompanyData companyData = SharedMock.prepareCompanyData();
        ContactData contactData = SharedMock.prepareContactDataMan();
        IdentificationData identificationData = SharedMock.prepareIdentificationDataMan();

        SmartAutoTasks smartAutoTasks = harness.tasks().auto().smartAuto();
        harness.withSmartAuto()
                .openLoginPage()
                .then(smartAutoTasks.login().loginWithCredentials(credentials))
                .then(smartAutoTasks.calculationType().makeCalculationAgroWithoutTPDeferredDrawing(calculationData))
                .then(smartAutoTasks.insuranceTasks().fillCustomerData(calculationData, smartAutoTasks, contactData, identificationData, companyData))
                .then(smartAutoTasks.insuranceTasks().fillInsuranceData(calculationData, smartAutoTasks))
                .then(smartAutoTasks.calculationType().closeInsuranceModal())
                .then(smartAutoTasks.verification().checkNewCalculation())
                .then(smartAutoTasks.save().saveNewCalculationPage())
                .clickCreateApplication()
                .then(smartAutoTasks.contact().fillCompanyInformation(companyData))
                .then(smartAutoTasks.identification().fillFirstRepresentativeIdentification(contactData, identificationData))
                .then(smartAutoTasks.bankContact().fillBusinessmanBankContact("212345", BankCode.KOMERCNI_BANKA))
                .then(smartAutoTasks.financial().fillDoubleEntry(150000, 10000, 20000, 50000, 200000))
                .then(smartAutoTasks.validation().validateCustomerPage())
                .then(smartAutoTasks.data().checkAgroInformation(Brand.JCB, Model.MODEL))
                .then(smartAutoTasks.data().fillDeferredDrawing("Popis", "Příslušenství"))
                .then(smartAutoTasks.validation().validateVehiclePage())
                .then(smartAutoTasks.account().fillOthersPageForStandard(721456790, "Testuji automaticky :)"))
                .then(smartAutoTasks.validation().validateOthersPage())
                .then(smartAutoTasks.application().sendApplicationPGRLF());
    }
}