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

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.wso2.data.CardData;
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 = "List CC by different input data")
public class ListCreditCards {
    private String card;
    private String contract;
    private SmokeData smokeData;

    @BeforeAll
    public void getInfo(Harness harness) {
        smokeData = SmokeData.getInstance(harness);
        CardData creditData = smokeData.getCreditData();
        card = creditData.getCard();
        contract = creditData.getContract();
    }

    @TestCase(environments = {Environment.TST3, Environment.FVE, Environment.PPE})
    @JiraTestCase(id = "FVP-T2734")
    public void MWFIR1plus_GET_CARD_LIST_BY_ID(Harness harness) {
        harness.tasks().wso2().restRequest()
                .prepareEmptyRequestFromCbl(smokeData.getPath("MWFIR1+"))
                .addField("ID", contract)
                .addField("Org", "500")
                .postExtended()
                .andAssertStatus(200)
                .andAssertPresent("UverovyRamec")
                .andAssertPresent("DisponibilniZustatek")
                .andAssertPresent("Data")
                .andAssertFieldValue("Data[0].CisloKarty", card.substring(3));
    }

}
