package cz.moneta.test.regression.channels.digital.web;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.util.task.monetaportal.MonetaPortalTasks;
import cz.moneta.test.harness.annotations.Environment;
import cz.moneta.test.harness.annotations.JiraTestCase;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import org.junit.jupiter.api.Disabled;

import static cz.moneta.test.dsl.monetaportal.enums.SearchBranchName.BRUMLOVKA;

@Disabled("Not currently maintained")
@TestScenario(name = "Check UDC loan")
public class UDCLoanTest {

    @TestCase(name = "Check UDC calculator", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "NWP-T400")
    public void tcUDCCalculator(Harness harness) {
        MonetaPortalTasks tasks = harness.tasks().monetaPortal();
        harness.withMonetaPortal()
                .openHomePage()
                .acceptCookies()
                .openLoansMenu()
                .openUdcLoan()
                .clickCalculatorSection()
                .then(tasks.calculatorTasks().fillLoanCalculator("550000", 36, 18));
    }

    @TestCase(name = "Check UDC form", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "NWP-T401")
    public void tcUDCLoanForm(Harness harness) {
        MonetaPortalTasks tasks = harness.tasks().monetaPortal();
        harness.withMonetaPortal()
                .openHomePage()
                .acceptCookies()
                .openLoansMenu()
                .openUdcLoan()
                .clickNaviblocksCreateUDCOnline()
                .then(tasks.formTasks().fillOnboardingForm("Petr","Testovič","petr.pollak@moneta.cz","777777777"));
    }

    @TestCase(name = "Check W2B for UDC loan page", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "NWP-T402")
    public void tcUDCLoanW2B(Harness harness) {
        MonetaPortalTasks tasks = harness.tasks().monetaPortal();
        harness.withMonetaPortal()
                .openHomePage()
                .acceptCookies()
                .openLoansMenu()
                .openUdcLoan()
                .clickNaviblocksW2B()
                .clickW2BSearchBranch()
                .fillW2BSearchBranch(BRUMLOVKA.getValue())
                .clickW2BSearchResultBranches(BRUMLOVKA)
                .clickW2BArrangeAppointment()
                .then(tasks.commonTasks().fillW2B(2,3,"Petr Testovič","777777777", "petr.pollak@moneta.cz"));
    }

    @TestCase(name = "Check IB from UDC loan page", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "NWP-T403")
    public void tcOpenIBPage(Harness harness) {
        harness.withMonetaPortal()
                .openHomePage()
                .acceptCookies()
                .openLoansMenu()
                .openUdcLoan()
                .openNaviblocksIB()
                .checkIBPage();
    }

    @TestCase(name = "Check W2C for UDC loan page", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "NWP-T404")
    public void tcUDCLoanW2C(Harness harness) {
        MonetaPortalTasks tasks = harness.tasks().monetaPortal();
        harness.withMonetaPortal()
                .openHomePage()
                .acceptCookies()
                .openLoansMenu()
                .openUdcLoan()
                .clickNaviblocksW2CLink()
                .then(tasks.commonTasks().fillW2C("777777777"));
    }
}