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 = "Building savings page")
public class BuildingSavingsTest {

    @TestCase(name = "Check Building savings calculator", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "NWP-T444")
    public void tcBuildingSavingsCalculator(Harness harness) {
        harness.withMonetaPortal()
                .openHomePage()
                .acceptCookies()
                .openSavingsMenu()
                .openBuildingSavingsPage()
                .clickBuildingSavingCalculatorAmountInput()
                .fillBuildingSavingCalculatorAmountInput("2300")
                .moveBuildingSavingCalculatorAmountSlider(20)
                .moveBuildingSavingCalculatorLengthBySlider(15);
                //.then(tasks.calculatorTasks().fillBusinessCalculator("440000", 94, "94", 88));
    }

    @TestCase(name = "Check Building savings A la carte form", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "NWP-T445")
    public void tcBuildingSavingsForm(Harness harness) {
        MonetaPortalTasks tasks = harness.tasks().monetaPortal();
        harness.withMonetaPortal()
                .openHomePage()
                .acceptCookies()
                .openSavingsMenu()
                .openBuildingSavingsPage()
                .clickNaviblocksBuildingSavingsCreateNewClientsOnline()
                .then(tasks.formTasks().fillOnboardingForm("Petr","Testovič","petr.pollak@moneta.cz","777777777"));

    }

    @TestCase(name = "Check IB from Building savings page", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "NWP-T446")
    public void tcBuildingSavingsIBPage(Harness harness) {
        harness.withMonetaPortal()
                .openHomePage()
                .acceptCookies()
                .openSavingsMenu()
                .openBuildingSavingsPage()
                .openNaviblocksOpenIB()
                .checkIBPage();
    }

    @TestCase(name = "Check W2B for Building savings page", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "NWP-T447")
    public void tcBuildingSavingsW2B(Harness harness) {
        MonetaPortalTasks tasks = harness.tasks().monetaPortal();
        harness.withMonetaPortal()
                .openHomePage()
                .acceptCookies()
                .openSavingsMenu()
                .openBuildingSavingsPage()
                .clickNaviblocksW2B()
                .clickW2BSearchBranch()
                .fillW2BSearchBranch(BRUMLOVKA.getValue())
                .clickW2BSearchResultBranches(BRUMLOVKA)
                .clickW2BArrangeAppointment()
                .then(tasks.commonTasks().fillW2B(4,5,"Petr Testovič", "777777777", "petr.pollak@moneta.cz"));
    }

    @TestCase(name = "Check W2C for Building savings page", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "NWP-T448")
    public void tcBuildingSavingsW2C(Harness harness) {
        MonetaPortalTasks tasks = harness.tasks().monetaPortal();
        harness.withMonetaPortal()
                .openHomePage()
                .acceptCookies()
                .openSavingsMenu()
                .openBuildingSavingsPage()
                .clickFooterCallFreeW2C()
                .then(tasks.commonTasks().fillW2C("777777777"));
    }
}