from __future__ import annotations

# ARCH_NOTE:
# - ActorMethodRef is a concrete execution target (address + actor_id + method),
#   not a logical alias.
# - This means flow topology currently captures materialized runtime bindings.
# - If we later add URI/logical-flow indirection, that resolution should happen
#   before dispatch and still produce ActorMethodRef for execution.
class ActorMethodRef:
    def __init__(self, address: str, actor_id: str, method: str):
        self.address = address
        self.actor_id = actor_id
        self.method = method

    def __call__(self, *args, **kwargs):
        from flownet.api.runtime import handle_actor_call
        return handle_actor_call(self, *args, **kwargs)
    
    def __reduce__(self):
        return (self.__class__, (self.address, self.actor_id, self.method))
