package cz.moneta.test.regression.commercial.smallbusiness.digital.backendtests;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.wso2.objects.smallbusiness.AresPoRefreshRequest;
import cz.moneta.test.dsl.wso2.objects.smallbusiness.AresPoRefreshResponse;
import cz.moneta.test.harness.annotations.JiraTestCase;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;

import static cz.moneta.test.harness.annotations.Environment.TST1;
import static org.junit.jupiter.api.Assertions.assertNotNull;

@TestScenario(name = "API Test for Forcing PO Update in CDI via ARES")
public class AresPoRefreshTest {
    private static final String ICO = "49062671";
    private static final String SSO = "543831687";

    @TestCase(name = "PO Update in CDI via ARES", environments = {TST1})
    @JiraTestCase(id = "SBD-T1202")

    public void aresPoRefreshTest(Harness harness) {
        AresPoRefreshResponse response = harness.tasks()
                .wso2()
                .restRequest()
                .prepareRequestFromUfo("/t/digitalchannels.sb/CBL/ARES_PO_REFRESH/001")
                .withPojoPayload(AresPoRefreshRequest.builder()
                        .ico(ICO)
                        .sso(SSO)
                        .build())
                .post()
                .andAssertStatus(200)
                .mapResponseIntoObject(AresPoRefreshResponse.class);
        assertNotNull(response, "API response must not be NULL");
    }
}