package cz.moneta.test.regression.cvm.api.cvm;

import com.fasterxml.jackson.databind.JsonNode;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import org.junit.jupiter.api.Assertions;

import static cz.moneta.test.harness.annotations.Environment.PPE;
import static cz.moneta.test.harness.annotations.Environment.TST1;

@TestScenario(name = "Call API CBL_DIGITALCHANNELS_LOAN_APPLICATION_LAST_STEP to WSO2 and assert response parameters")
public class ApiCblDigitalchannelsLoanApplicationLastStep {

    @TestCase(name = "Call API CBL_DIGITALCHANNELS_LOAN_APPLICATION_LAST_STEP to WSO2", environments = {TST1, PPE})
    public void postCblDigitalchannelsLoanApplicationLastStep(Harness harness) {
        JsonNode body = harness.tasks().wso2().restRequest().prepareRequestFromCvm(
                "cvm.cluster/CBL_DIGITALCHANNELS_LOAN_APPLICATION_LAST_STEP/001", false,
                "{\n" +
                        "  \"userId\": " + harness.getConfig("cvm.client.userid") + "\n" +
                        "}")
                .post()
                .andAssertStatus(200)
                .extract("");

        Assertions.assertNotNull(body, "Not found output in response");
    }
}