package cz.moneta.test.regression.backoffice.exevido.web.inheritance;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.util.credentials.Keys;
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 org.junit.jupiter.api.AfterEach;

import static cz.moneta.test.dsl.exevido.pages.NewIncomingMessagePage.INCOMING_MESSAGE_ID_KEY;
import static cz.moneta.test.dsl.util.task.ufo.cb.CommercialTasks.JIRA_COMMENT_STORE_KEY;

@TestScenario(name = "Mark message as irrelevant")
public class MarkMessageAsIrrelevant {

    @TestCase(name = "Mark message as irrelevant")
    @JiraTestCase(id = "BOC-T8948")
    public void markMessageAsIrrelevant(Harness harness, @Key(Keys.exevido.inheritance) Credentials credentials) {
        harness.withExevido()
                .openLoginPage()
                .then(harness.tasks().exevidoTasks().login().withCredentialsToMmb(credentials))
                .clickInheritanceMmbForProcessing()
                .clickRequestMmb()
                .searchByDateRange("01.08.2023 - 31.08.2025")
                .clickIncomingMessageRowCheckbox()
                .saveMessageID()
                .clickMarkAsIrrelevantMessage()
                .addIrrelevantReason("Test irelevantní");
    }

    @AfterEach
    protected void tearDown(Harness harness) {
        harness.store(JIRA_COMMENT_STORE_KEY,
                "\nMessage ID: " + harness.get(INCOMING_MESSAGE_ID_KEY, true));
    }
}