# Path: osbrain/common.py
# def unique_identifier() -> bytes:
#     """
#     Returns
#     -------
#         A unique identifier that is safe to use in PUB-SUB communication
#         patterns (i.e.: does not contain the
#         :py:data:`osbrain.agent.TOPIC_SEPARATOR` character).
#     """
#     return uuid4().hex.encode()


from ipaddress import ip_address
from .common import unique_identifier
import zmq
    Channels are communication means with sender and receiver in both sides
    (i.e.: PULL+PUB - PUSH-SUB or PULL+PUSH - PUSH+PULL).

    Parameters
    ----------
    kind : AgentChannelKind
        Agent kind.
    sender : str
        First AgentAddress.
    receiver : str
        Second AgentAddress.

    Attributes
    ----------
    kind : AgentChannelKind
        Agent kind.
    sender : str
        First AgentAddress.
    receiver : str
        Second AgentAddress.
    """

    def __init__(self, kind, receiver, sender, twin_uuid=None):
        self.kind = AgentChannelKind(kind)
        self.receiver = receiver
        self.sender = sender
        self.transport = receiver.transport if receiver else sender.transport
        self.serializer = (
            receiver.serializer if receiver else sender.serializer
        )

# Path: osbrain/common.py
# def unique_identifier() -> bytes:
#     """
#     Returns
#     -------
#         A unique identifier that is safe to use in PUB-SUB communication
#         patterns (i.e.: does not contain the
#         :py:data:`osbrain.agent.TOPIC_SEPARATOR` character).
#     """
#     return uuid4().hex.encode()


# Path: osbrain/address.py
from ipaddress import ip_address
from .common import unique_identifier
import zmq

    Channels are communication means with sender and receiver in both sides
    (i.e.: PULL+PUB - PUSH-SUB or PULL+PUSH - PUSH+PULL).

    Parameters
    ----------
    kind : AgentChannelKind
        Agent kind.
    sender : str
        First AgentAddress.
    receiver : str
        Second AgentAddress.

    Attributes
    ----------
    kind : AgentChannelKind
        Agent kind.
    sender : str
        First AgentAddress.
    receiver : str
        Second AgentAddress.
    """

    def __init__(self, kind, receiver, sender, twin_uuid=None):
        self.kind = AgentChannelKind(kind)
        self.receiver = receiver
        self.sender = sender
        self.transport = receiver.transport if receiver else sender.transport
        self.serializer = (
            receiver.serializer if receiver else sender.serializer
        )

        self.uuid = unique_identifier()