from __future__ import annotations

import logging
from typing import TYPE_CHECKING, Any, Protocol

if TYPE_CHECKING:
    from casty.actor import Behavior
    from casty.mailbox import Mailbox
    from casty.ref import ActorRef


class ActorContext[M](Protocol):
    @property
    def self(self) -> ActorRef[M]: ...

    @property
    def log(self) -> logging.Logger: ...

    def spawn[C](
        self,
        behavior: Behavior[C],
        name: str,
        *,
        mailbox: Mailbox[C] | None = None,
    ) -> ActorRef[C]: ...

    def stop(self, ref: ActorRef[Any]) -> None: ...

    def watch(self, ref: ActorRef[Any]) -> None: ...

    def unwatch(self, ref: ActorRef[Any]) -> None: ...
