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 express loan page")
public class ExpressLoanTest {

    @TestCase(name = "Check express loan calculator", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "NWP-T360")
    public void tcExpressLoanCalculator(Harness harness) {
        MonetaPortalTasks tasks = harness.tasks().monetaPortal();
        harness.withMonetaPortal()
                .openHomePage()
                .acceptCookies()
                .openLoansMenu()
                .openExpressLoanPage()
                .then(tasks.calculatorTasks().fillLoanBannerCalculator("450000", 36, 12));
    }

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

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

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