package cz.moneta.test.regression.transactional.payments.cash.kasanova.section1;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.kasanova.components.enums.KSNAccounts;
import cz.moneta.test.dsl.kasanova.components.enums.KSNCoinSplits;
import cz.moneta.test.dsl.kasanova.components.enums.KSNOriginDeposit;
import cz.moneta.test.dsl.kasanova.components.enums.KSNRelationShipToTheOwner;
import cz.moneta.test.dsl.util.credentials.Keys.kasanova;
import cz.moneta.test.harness.annotations.JiraTestCase;
import cz.moneta.test.harness.annotations.NonConcurrentTestScenario;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.support.auth.Credentials;
import cz.moneta.test.harness.support.auth.Key;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.TestMethodOrder;

@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@NonConcurrentTestScenario(name = "(Fce 13) Vklad v měně účtu, TV)")
public class KSNFunction13Test {

    @Order(1)
    @JiraTestCase(id = "PAY-T1385")
    @TestCase(name = "(Fce 13 - 3.osoba - podlimit)")
    public void func13underLimitNoDispo(Harness harness, @Key(kasanova.banker) Credentials banker) {

        harness.log("---------------- START TEST (FUNCTION 13 UnderLimitNoDispo) ----------------");

        harness.withKasanova()
                .openLoginPage()
                .then(harness.tasks().kasanova().loginWithUserAndPassword(banker))
                .KSNSection1()
                .KSNFunction13()
                .MA_AccountNumber(KSNAccounts.TV_CZK_156748779.getValue())
                .enterFunction13()
                .depositAmount("400")
                .coinSplitTable(KSNCoinSplits.COINSPLIT_CZK_100_INPUT, "4")
                .fillIdentificationAndSymbolsShort()
                .continueWithPrintAction()
                .dismissPrintWindow()
                .continueWithSaveAction()
                .checkFunctionIsDone()
                .logOut();

        harness.log("---------------- END TEST (FUNCTION 13 UnderLimitNoDispo) ----------------");
    }

    @Order(2)
    @JiraTestCase(id = "PAY-T1386")
    @TestCase(name = "(Fce 13 - 3.osoba - mezilimit")
    public void func13middleLimitNoDispo(Harness harness, @Key(kasanova.banker) Credentials banker) {

        harness.log("---------------- START TEST (FUNCTION 13 MiddleLimitNoDispo) ----------------");

        harness.withKasanova()
                .openLoginPage()
                .then(harness.tasks().kasanova().loginWithUserAndPassword(banker))
                .KSNSection1()
                .KSNFunction13()
                .MA_AccountNumber(KSNAccounts.TV_CZK_156748779.getValue())
                .enterFunction13()
                .depositAmount("50000")
                .coinSplitTable(KSNCoinSplits.COINSPLIT_CZK_5000_INPUT, "10")
                .fillIdentificationAndSymbolsLong()
                .continueWithPrintAction()
                .kasanovaDialogClickYes()
                .dismissPrintWindow()
                .continueWithSaveAction()
                .checkFunctionIsDone()
                .logOut();

        harness.log("---------------- END TEST (FUNCTION 13 MiddleLimitNoDispo) ----------------");
    }

    @Order(3)
    @JiraTestCase(id = "PAY-T1387")
    @TestCase(name = "(Fce 13 - 3.osoba - nadlimit")
    public void func13overLimitNoDispo(Harness harness, @Key(kasanova.banker) Credentials banker) {

        harness.log("---------------- START TEST (FUNCTION 13 OverLimitNoDispo) ----------------");

        harness.withKasanova()
                .openLoginPage()
                .then(harness.tasks().kasanova().loginWithUserAndPassword(banker))
                .KSNSection1()
                .KSNFunction13()
                .MA_AccountNumber(KSNAccounts.TV_CZK_156748779.getValue())
                .enterFunction13()
                .depositAmount("500000")
                .kasanovaDialogClickOK()
                .originePurpose(KSNOriginDeposit.PUVOD_VKLADU_3.getValue())
                .relationToTheOwner(KSNRelationShipToTheOwner.VZTAH_K_MAJITELI_21.getValue())
                .coinSplitTable(KSNCoinSplits.COINSPLIT_CZK_5000_INPUT, "100")
                .fillIdentificationAndSymbolsLong()
                .continueWithPrintAction()
                .kasanovaDialogClickYes()
                .dismissPrintWindow()
                .continueWithSaveAction()
                .checkFunctionIsDone()
                .logOut();

        harness.log("---------------- END TEST (FUNCTION 13 OverLimitNoDispo) ----------------");
    }

}
