// ── models_memory.go ────────────────────────
// Memory model for v0.18.0 — add these types to models/models.go
// (or keep as a separate file in the models package)

package models

import "time"

// ── Memory Scope Constants ──────────────────

const (
	MemoryScopeUser        = "user"         // personal facts, persists across all conversations
	MemoryScopePersona     = "persona"      // shared across all users of a Persona
	MemoryScopePersonaUser = "persona_user" // per-user within a Persona context
)

// ── Memory Status Constants ─────────────────

const (
	MemoryStatusActive        = "active"
	MemoryStatusPendingReview = "pending_review"
	MemoryStatusArchived      = "archived"
)

// Memory represents a single fact or preference persisted across conversations.
type Memory struct {
	ID              string    `json:"id" db:"id"`
	Scope           string    `json:"scope" db:"scope"`
	OwnerID         string    `json:"owner_id" db:"owner_id"`
	UserID          *string   `json:"user_id,omitempty" db:"user_id"`
	Key             string    `json:"key" db:"key"`
	Value           string    `json:"value" db:"value"`
	SourceChannelID *string   `json:"source_channel_id,omitempty" db:"source_channel_id"`
	Confidence      float64   `json:"confidence" db:"confidence"`
	Status          string    `json:"status" db:"status"`
	CreatedAt       time.Time `json:"created_at" db:"created_at"`
	UpdatedAt       time.Time `json:"updated_at" db:"updated_at"`
}

// MemoryFilter specifies which memories to retrieve.
type MemoryFilter struct {
	Scope    string  // required: user, persona, persona_user
	OwnerID  string  // required: user_id or persona_id
	UserID   *string // only for persona_user scope
	Status   string  // default: "active"
	Query    string  // optional: keyword filter on key+value
	Limit    int     // max results (default 50)
}
