from typing import Dict
from typing import List
from typing import Set
from typing import Tuple


def _validate_reply(
    reply: Dict[str, List[str]], performatives_set: Set[str]
) -> Tuple[bool, str]:
    """
    Evaluate whether the reply structure in a protocol specification is valid.

    :param reply: Reply structure of a dialogue.
    :param performatives_set: set of all performatives in the dialogue.

    :return: Boolean result, and associated message.
    """
    performatives_set_2 = performatives_set.copy()

    for performative in reply.keys():
        if performative not in performatives_set_2:
            return (
                False,
                "Performative '{}' specified in \"reply\" is not defined in the protocol's speech-acts.".format(
                    performative,
                ),
            )
        performatives_set_2.remove(performative)

    if len(performatives_set_2) != 0:
        return (
            False,
            "No reply is provided for the following performatives: {}".format(
                performatives_set_2,
            ),
        )

    return True, "Reply structure is valid."