"""MemoryEdge — a typed, weighted relationship between two MemoryNodes."""

from __future__ import annotations

import uuid
from datetime import datetime, timezone

from pydantic import BaseModel, Field


class MemoryEdge(BaseModel):
    """A directed edge connecting two memory nodes.

    Edges carry a relationship type (e.g. "decided", "owns", "related_to",
    "caused") and a strength score that can decay or be reinforced over time.
    """

    id: str = Field(default_factory=lambda: uuid.uuid4().hex)
    source_id: str
    target_id: str
    relationship_type: str
    strength: float = Field(default=1.0, ge=0.0, le=1.0)
    timestamp: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))

    model_config = {"frozen": False}
