package cz.moneta.test.sanity.transactional.cards.wso2.pilotwso2;

import cz.moneta.test.dsl.Harness;
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 cz.moneta.test.sanity.transactional.SmokeData;
import org.junit.jupiter.api.BeforeAll;

@TestScenario(name = "CARD_SERVICING_GET_LAST_STATE_AMNT")
public class AccountState {
    private SmokeData smokeData;
    private String account;
    private String card;

    @BeforeAll
    public void getInfo(Harness harness) {
        smokeData = SmokeData.getInstance(harness);
        account = smokeData.getCreditData().getAccount();
        card = smokeData.getCreditData().getCard();
    }

    @TestCase(environments = {Environment.TST3, Environment.FVE, Environment.PPE})
    @JiraTestCase(id = "FVP-T1938")
    public void MWF4H9GetCardServLastStateAmnt(Harness harness) {
        harness.tasks().wso2().restRequest()
                .prepareEmptyRequestFromCbl(smokeData.getPath("MWF4H9"))
                .addField("CisloKaretnihoUctu", account)
                .postExtended()
                .andAssertStatus(200)
                .andAssertPresent("DisponibilniZustatek")
                .andAssertPresent("UverovyRamec")
                .andAssertPresent("UverovyRamecVycerpany")
                .andAssertPresent("VysePosledniSplatky");
    }

    @TestCase(environments = {Environment.TST3, Environment.FVE, Environment.PPE})
    @JiraTestCase(id = "FVP-T1953")
    public void MWFBK2_CHK_CARD_STATUS(Harness harness) {
        harness.tasks().wso2().restRequest()
                .prepareEmptyRequestFromUfo(smokeData.getPath("MWFBK2"))
                .addField("CisloKarty", card)
                .addField("PrvniSada", "500")
                .addField("PrvniSadaBlockAccountExcept", "R")
                .addField("PrvniSadaNonBlockedAccount", "1")
                .addField("PrvniSadaNonExpired", "1")
                .addField("DruhaSada", "600")
                .addField("DruhaSadaBlockAccountExcept", "R")
                .addField("DruhaSadaNonBlockedAccount", "1")
                .addField("DruhaSadaNonExpired", "1")
                .postExtended()
                .andAssertStatus(200)
                .andAssertFieldValue("Vysledek", "OK");
    }
}
