package usecase

import (
	"context"

	libkg "haixun-backend/internal/library/knowledge"
)

type GraphSummary struct {
	ID           string
	BrandID      string
	Seed         string
	Nodes        []libkg.Node
	Edges        []libkg.Edge
	BraveSources []libkg.BraveSource
	PainTagCount int
	GeneratedAt  int64
	CreateAt     int64
	UpdateAt     int64
}

type UpsertRequest struct {
	TenantID     string
	OwnerUID     string
	BrandID      string
	Seed         string
	Nodes        []libkg.Node
	Edges        []libkg.Edge
	BraveSources []libkg.BraveSource
	PainTagCount int
	GeneratedAt  int64
}

type NodeSelectionUpdate struct {
	NodeID          string
	SelectedForScan bool
}

type UpdateNodesRequest struct {
	TenantID string
	OwnerUID string
	BrandID  string
	Updates  []NodeSelectionUpdate
}

type UseCase interface {
	Get(ctx context.Context, tenantID, ownerUID, brandID string) (*GraphSummary, error)
	Upsert(ctx context.Context, req UpsertRequest) (*GraphSummary, error)
	UpdateNodeSelections(ctx context.Context, req UpdateNodesRequest) (*GraphSummary, error)
}
