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

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 cz.moneta.test.sanity.transactional.cards.firstvision.Embosser;
import org.junit.jupiter.api.BeforeAll;

@TestScenario(name = "CARD_DELIVERY_TRACK_STATUS")
public class CardDelivery {
    private String mailingId;
    private String card;
    private SmokeData smokeData;

    @BeforeAll
    public void getInfo(Harness harness) {
        smokeData = SmokeData.getInstance(harness);
        card = smokeData.getCreditData().getCard();
        mailingId = Embosser.getEmbosser(harness, "E8V7B", card).extract("VMX_ROOT.VMX_MSGOUT.USER_3").textValue();
    }

    @TestCase(environments = {Environment.TST3, Environment.FVE, Environment.PPE})
    @JiraTestCase(id = "FVP-T2431")
    public void MWFJJ8_CHG_CARD_DELIVERY_TRACK_STATUS(Harness harness) {
        // change
        harness.tasks().wso2().restRequest()
                .prepareEmptyRequestFromUfo(smokeData.getPath("MWFJJ8"))
                .addField("MailingID", mailingId)
                .addField("StavDodani", "1")  // ON_THE_WAY_TO_BRANCH
                .addField("DuvodVraceni", 3) //ADDRESSEE_NOT_FOUND
                .postExtended()
                .andAssertStatus(200);
    }
}
