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.AgroMock;
import cz.moneta.test.regression.commercial.auto.smartauto.mockdata.SharedMock;
import org.junit.jupiter.api.Disabled;

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

    @JiraTestCase(id = "LAMD-T1359")
    @TestCase(name = "Customer : Businessman_with_vat | State : New | Vat : Yes | Agro : Registered | Donation : Young farmer")
    public void tcCalculationAgro1() {
        agroTpTasks(AgroMock.prepareCalculationAgro1());
    }

    @JiraTestCase(id = "LAMD-T1373")
    @TestCase(name = "Customer : Businessman_with_vat | State : Used | Vat : Yes | Agro : Registered | Donation : Young farmer")
    public void tcCalculationAgro2() {
        agroTpTasks(AgroMock.prepareCalculationAgro2());
    }

    @JiraTestCase(id = "LAMD-T1374")
    @TestCase(name = "Customer : Businessman_without_vat | State : New | Vat : Yes | Agro : Registered | Donation : Young farmer")
    public void tcCalculationAgro3() {
        agroTpTasks(AgroMock.prepareCalculationAgro3());
    }

    @JiraTestCase(id = "LAMD-T1375")
    @TestCase(name = "Customer : Businessman_without_vat | State : Used | Vat : Yes | Agro : Registered | Donation : Young farmer")
    public void tcCalculationAgro4() {
        agroTpTasks(AgroMock.prepareCalculationAgro4());
    }

    @JiraTestCase(id = "LAMD-T1514")
    @TestCase(name = "Deferred drawing | Customer : Businessman_without_vat | State : New | Vat : Yes | Agro : Registered | Donation : Young farmer")
    public void tcCalculationAgro5(Harness harness, @Key(smart.auto.general) Credentials credentials) {
        CalculationData calculationData = AgroMock.prepareCalculationAgro5();
        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().makeCalculationAgroDeferredDrawing(calculationData))
                .then(smartAutoTasks.insuranceTasks().fillCustomerData(calculationData, smartAutoTasks, companyData))
                .then(smartAutoTasks.insuranceTasks().fillInsuranceData(calculationData, smartAutoTasks))
                .then(smartAutoTasks.calculationType().closeInsuranceModal())
                .then(smartAutoTasks.verification().checkNewCalculation())
                .then(smartAutoTasks.save().saveNewCalculationPage())
                .clickCreateApplication()
                .then(smartAutoTasks.contact().fillCompanyInformationFallbackAgro(companyData))
                .then(smartAutoTasks.identification().fillFirstRepresentativeIdentification(contactData, identificationData))
                .then(smartAutoTasks.bankContact().fillBusinessmanBankContact("51", 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());
    }
}