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

@Disabled
@TestScenario(name = "Successful filled vehicle.")
public class VehicleTest extends InsuranceAndBenefitData {

    @JiraTestCase(id = "LAMD-T1026")
    @TestCase(name = "Successful filled vehicle using filters.")
    public void tcVehicleWithFilters(Harness harness, @Key(smart.auto.general) Credentials credentials) {
        SmartAutoTasks smartAutoTasks = harness.tasks().auto().smartAuto();
        CalculationData calculationData = CarMock.prepareCalculationCar1();
        ContactData contactData = SharedMock.prepareContactDataMan();
        IdentificationData identificationData = SharedMock.prepareIdentificationDataMan();

        harness.withSmartAuto()
                .openLoginPage()
                .then(smartAutoTasks.login().loginWithCredentials(credentials))
                .then(smartAutoTasks.calculationType().makeCalculation(calculationData))
                .then(smartAutoTasks.insuranceTasks().fillCustomerData(calculationData, smartAutoTasks, contactData, identificationData))
                .then(smartAutoTasks.insuranceTasks().fillInsuranceDataFilters(calculationData, smartAutoTasks))
                .then(smartAutoTasks.calculationType().closeInsuranceModal())
                .clickCreateApplication()
                .clickVehiclePage()
                .then(smartAutoTasks.data().checkVehicleInformation(Brand.SKODA, Model.FABIA))
                .then(smartAutoTasks.search().searchVehicleWithFilters(FilterFuel.PETROL, "70", FilterBodywork.OTHERS, FilterGearbox.MANUAL, FilterDoors.FOUR_TO_FIVE, Model.FABIA))
                .then(smartAutoTasks.data().checkAndAddAdditionalData(FilterFuel.PETROL, 5000, "Popis vozidla", ImportVehicle.NO, DealerIsOwner.NO))
                .then(smartAutoTasks.validation().validateVehiclePage());
    }

    @JiraTestCase(id = "LAMD-T1027")
    @TestCase(name = "Successful filled vehicle using VIN.")
    public void tcVehicleWithVin(Harness harness, @Key(smart.auto.general) Credentials credentials) {
        SmartAutoTasks smartAutoTasks = harness.tasks().auto().smartAuto();
        CalculationData calculationData = CarMock.prepareCalculationCar1();
        ContactData contactData = SharedMock.prepareContactDataMan();
        IdentificationData identificationData = SharedMock.prepareIdentificationDataMan();

        harness.withSmartAuto()
                .openLoginPage()
                .then(smartAutoTasks.login().loginWithCredentials(credentials))
                .then(smartAutoTasks.calculationType().makeCalculation(calculationData))
                .then(smartAutoTasks.insuranceTasks().fillCustomerData(calculationData, smartAutoTasks, contactData, identificationData))
                .then(smartAutoTasks.insuranceTasks().fillInsuranceData(calculationData, smartAutoTasks))
                .then(smartAutoTasks.calculationType().closeInsuranceModal())
                .clickCreateApplication()
                .clickVehiclePage()
                .then(smartAutoTasks.data().checkVehicleInformation(Brand.SKODA, Model.FABIA))
                .then(smartAutoTasks.search().searchVehicleWithVin(calculationData.getVin(), FilterFuel.PETROL, Model.FABIA))
                .then(smartAutoTasks.data().checkAndAddAdditionalData(FilterFuel.PETROL, 5000, "Popis vozidla", ImportVehicle.NO, DealerIsOwner.NO))
                .then(smartAutoTasks.validation().validateVehiclePage());
    }
}