package cz.moneta.test.dsl.ufo.operations.shared.topmenu;

import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.ufo.UfoEndpoint;
import cz.moneta.test.harness.support.web.*;
import org.junit.jupiter.api.Assertions;

public interface XXX702_ClientDetail<T extends WebFlow<T>> extends WebFlow<T>, StoreAccessor {

    String CLIENT_CIF_LABEL = "XXX702_T002_L101";
    String CLIENT_RC_LABEL = "XXX702_T001_L009";
    String CONSENTS_101_MMB_LABEL = "XXX702_T001_L261";
    String RELATIONSHIP_LABEL = "XXX702_T001_L230";

    @CheckElementContent(CLIENT_RC_LABEL)
    T assertClientRc(String rc);

    @CheckElementContent(RELATIONSHIP_LABEL)
    T assertClientRelationship(String relationship);

    @Wait(value = CLIENT_CIF_LABEL, until = Until.VISIBLE)
    @ExecuteJavaScript("navigator.clipboard.writeText(document.getElementById('" + CLIENT_CIF_LABEL + "').textContent)")
    T copyCifNumberToClipboard();

    @Wait(value = CONSENTS_101_MMB_LABEL)
    @CustomAction
    default T checkClientConsentsMMBTitle(String expectedTitle) {
        UfoEndpoint endpoint = getEndpoint(UfoEndpoint.class);
        Assertions.assertEquals(expectedTitle, endpoint.getAttribute(CONSENTS_101_MMB_LABEL, "title"));
        return null;
    }
}