package cz.moneta.test.regression.channels.digital.ib.newib.settings;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.newib.tasks.NewIbTasks;
import cz.moneta.test.dsl.newib.util.TrustedContactsFormData;
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.TestScenarioWithOrder;
import cz.moneta.test.harness.support.auth.Credentials;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Order;

@TestScenarioWithOrder(name = "Trusted contacts")
public class TrustedContactsSettingsTest {
    Credentials clientCredentials;
    TrustedContactsFormData formData;

    @BeforeAll
    public void getCredentials(Harness harness) {
        String clientBirthNumber = harness.getConfig("nib.rc.limits");

        clientCredentials = harness.tasks()
                .udebs()
                .findCredentialsByRC(clientBirthNumber);

        formData = TrustedContactsFormData.builder()
                .setNameOfTrustedContactLong("123456789123456789201234")
                .setNameOfTrustedContactShort("4545")
                .build();
    }

    //trusted contacts not possible right now
    @Order(1)
    @TestCase(name = "Check Trusted contacts in settings", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "SB-T9346")
    public void checkTrustedContactsSettings(Harness harness) {
        NewIbTasks newIbTasks = harness.tasks().newIb();

        harness.withNewIb()
                .openLoginPage()
                .then(newIbTasks.loginWithUsernamePasswordAndDefaultMobKey(clientCredentials.getUsername(), clientCredentials.getPassword()))
                .then(newIbTasks.checkTrustedContacts(formData));
    }
}
