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.auto.smartauto.util.MonthUtil;
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 org.junit.jupiter.api.Disabled;

@Disabled
@TestScenario(name = "Successful filled others.")
public class OthersTest {

    @JiraTestCase(id = "LAMD-T1025")
    @TestCase(name = "Successful filled others.")
    public void tcOthersC2C(Harness harness, @Key(smart.auto.general) Credentials credentials) {
        SmartAutoTasks smartAutoTasks = harness.tasks().auto().smartAuto();
        CalculationData calculationData = prepareCalculationData(Customer.CONSUMER);

        harness.withSmartAuto()
                .openLoginPage()
                .then(smartAutoTasks.login().loginWithCredentials(credentials))
                .then(smartAutoTasks.calculationType().makeCalculation(calculationData))
                .clickCreateApplication()
                .clickOthersPage()
                .then(smartAutoTasks.account().fillOthersPageForC2CConsumer(721456789, 19, BankCode.KOMERCNI_BANKA, "Testuji automaticky :)", "František", "Tester", "19.02.2002"))
                .then(smartAutoTasks.validation().validateOthersPage());
    }

    private CalculationData prepareCalculationData(Customer customer) {
        CalculationData calculationData = new CalculationData();
        return calculationData.setCustomer(customer)
                .setPrClass(PrClass.CARNEW)
                .setPrGroup(PrGroup.CAR)
                .setGroup(Group.M1)
                .setBrand(Brand.SKODA)
                .setModel(Model.FABIA)
                .setPrice(300000)
                .setVat(Vat.NO)
                .setUsage(Usage.OTHERS)
                .setMonth(MonthUtil.getCurrentMonth())
                .setProduct(Product.AUTO_CREDIT_C2C);
    }
}