package cz.moneta.test.system.wso2;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.mwf.CMH_MSG_EMAIL_PLANNED;
import cz.moneta.test.dsl.mwf.CMH_MSG_EMAIL_PLANNEDResponse;
import cz.moneta.test.dsl.mwf.getstatus.GET_STATUS;
import cz.moneta.test.dsl.mwf.getstatus.GET_STATUSResponse;
import cz.moneta.test.harness.annotations.Environment;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import cz.moneta.test.harness.support.util.Level;
import org.junit.jupiter.api.Assertions;

@TestScenario(name = "System test for sending TIF messages to WSO2")
public class SendTifMessageToWSO2 {

    @TestCase(name = "Sends an marketing email to client for a planned marketing campaign", environments = {Environment.TST1, Environment.TST3, Environment.PPE, Environment.EDU})
    public void sendMarketingEmail(Harness harness) {
        CMH_MSG_EMAIL_PLANNEDResponse response = harness.withWso2()
                .prepareTifRequestAsUfo(CMH_MSG_EMAIL_PLANNED.class)
                .clientAddressTo("jiri.jaros1@moneta.cz")
                .clientBirthNum("6543211234")
                .cmpId(188729L)
                .gwSysId("14")
                .mesgAllowPairing(1L)
                .mesgParams("01.06.2020")
                .refId(999L)
                .send();

        harness.log(Level.INFO, "Response message from WSO2: " + response.toString());
        Assertions.assertNotNull(response.mesgId().toString(), "Reponse MESG_ID is empty.");
    }

    @TestCase(name = "Sends get status message", environments = {Environment.TST1, Environment.TST3, Environment.PPE, Environment.EDU})
    public void getStatusMessage(Harness harness) {
        GET_STATUSResponse response = harness.withWso2()
                .prepareTifRequestAsCbl(GET_STATUS.class)
                .send();

        harness.log(Level.INFO, "Response message from WSO2: " + response.toString());
        Assertions.assertNotNull(response.statusCode().toString(), "Reponse STATUS_CODE is empty.");
    }
}
