"""Zalo CRM Repository Port (Domain Interface)."""

from __future__ import annotations

from typing import Any, Protocol, runtime_checkable


@runtime_checkable
class ZaloCrmRepositoryPort(Protocol):
    """Port for persistence of contacts, conversations, and messages in Zalo CRM."""

    def upsert_contact(self, contact: dict[str, Any]) -> Any:
        """Upsert contact details."""
        ...

    def upsert_zalo_account(self, account: dict[str, Any]) -> Any:
        """Upsert company Zalo account."""
        ...

    def upsert_conversation(self, conversation: dict[str, Any]) -> Any:
        """Upsert conversation thread."""
        ...

    def insert_message(self, message: dict[str, Any]) -> Any:
        """Insert inbound or outbound message."""
        ...

    def get_all_contacts(self) -> list[dict[str, Any]]:
        """Retrieve all contacts."""
        ...

    def get_messages_by_conversation(self, conv_id: str) -> list[dict[str, Any]]:
        """Retrieve message history for a conversation."""
        ...
