package domain

import "context"

type Repository interface {
	// Trends are global-ish; refresh rewrites owner's view cache
	ListTrends(ctx context.Context, ownerUID int64) ([]*TrendItem, error)
	SaveTrends(ctx context.Context, ownerUID int64, items []*TrendItem) error

	ListElements(ctx context.Context, ownerUID int64) ([]*Element, error)
	SaveElement(ctx context.Context, e *Element) error
	DeleteElement(ctx context.Context, id string) error
	GetElement(ctx context.Context, id string) (*Element, error)

	// Sessions — 多對話；GetSession 回 active（無則建新）
	ListSessions(ctx context.Context, ownerUID int64) ([]*Session, error)
	GetSession(ctx context.Context, ownerUID int64) (*Session, error) // active
	GetSessionByID(ctx context.Context, ownerUID int64, id string) (*Session, error)
	SaveSession(ctx context.Context, s *Session) error
	DeleteSessionByID(ctx context.Context, ownerUID int64, id string) error
	GetActiveSessionID(ctx context.Context, ownerUID int64) (string, error)
	SetActiveSessionID(ctx context.Context, ownerUID int64, sessionID string) error
}
