package cz.moneta.test.regression.channels.digital.ib.oldib.insurance;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.util.task.ib.IbTasks;
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.auth.Credentials;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;

@TestScenario(name = "Test create exhausted amount insurance for client with Smart credit card in IB")
public class ExhaustedAmountInsuranceTest {

    private String mobileKey = IbTasks.DEFAULT_MOBILE_KEY;
    private String birthNumber;
    private Credentials userCredentialsIb;

    @BeforeEach
    void cancelInsurance(Harness harness) {
        birthNumber = harness.getConfig("IB.rc.smart-card");

        userCredentialsIb = harness.tasks()
                .udebs()
                .findCredentialsByRC(birthNumber);

        harness.tasks()
                .wso2()
                .cards()
                .deactivateExhaustedAmountInsuranceCreditCard(birthNumber);
    }

    @Disabled
    @TestCase(name = "Exhausted amount insurance test for client with Smart credit card", environments = Environment.PPE)
    void exhaustedAmountInsuranceTestForSmartCard(Harness harness) {
        IbTasks taskIb = harness.tasks().ib();

        harness.withIB()
                .openLoginPage()
                .then(taskIb.loginWithDefaultMobileKeyAnd(userCredentialsIb))
                .checkAndConfirmCookies()
                .clickInsurance()
                .clickCreateExhaustedAmountInsurance()
                .clickCheckToInformationMaterial()
                .clickAgreementWithInsurance()
                .clickCountinueButton()
                .fillInMobileKey(mobileKey)
                .clickSignButton()
                .clickCards()
                .clickToAdditionalServices()
                .waitToAdditional();
    }
}