package cz.moneta.test.regression.ufoframework;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.ufo.operations.recorder.RecorderNameOfGroup;
import cz.moneta.test.dsl.util.credentials.Keys;
import cz.moneta.test.dsl.util.task.ufo.operations.OperationsTasks;
import cz.moneta.test.harness.annotations.JiraTestCase;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import cz.moneta.test.harness.support.auth.Credentials;
import cz.moneta.test.harness.support.auth.Key;
import cz.moneta.test.regression.commercial.smallbusiness.digital.TearDown;
import org.junit.jupiter.api.AfterEach;

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

@TestScenario(name = "Slave Session Ufo Operations")
public class SlaveSessionUfoOperations {

    @TestCase(name = "Slave Session Ufo Operations", environments = {TST1, PPE, DEV})
    @JiraTestCase(id = "UFO-T506")
    public void slaveSessionUfoOperations(Harness harness, @Key(Keys.ufo.banka.banker) Credentials credentials) {

        RecorderNameOfGroup[] requirements = {
                RecorderNameOfGroup.CC_INCOMING_CALL,
                RecorderNameOfGroup.CC_OUTCOMING_CALL,
                RecorderNameOfGroup.CC_SUGGESTIONS_TO_IMPROVE_AND_PRAISES,
                RecorderNameOfGroup.CC_CENTER_AUTO,
                RecorderNameOfGroup.GECL,
                RecorderNameOfGroup.MMB,
                RecorderNameOfGroup.CARDS_CREDIT,
                RecorderNameOfGroup.TELEMARKETING,
                RecorderNameOfGroup.SALES,
                RecorderNameOfGroup.RETENTION,
                RecorderNameOfGroup.CLIENT_SERVICE_ABROAD
        };

        OperationsTasks operationsTasksTasks = harness.tasks().ufo().operations();
        harness.withUfo()
                .openLoginPage()
                .then(operationsTasksTasks.login().withCredentials(credentials))
                .clickRecorder()
                .checkRequirementsAreVisible(requirements);
    }

    @AfterEach
    protected void tearDown(Harness harness) {
        TearDown.storeBirthNumberFullNameCifSessionId(harness);
    }
}
