package personagen

import (
	"context"
	"encoding/json"
	"time"
)

// PersonaRecord is a minimal representation of a persona row for the worker pipeline.
// It mirrors the database columns needed for stage-based generation without
// importing service-internal domain types.
type PersonaRecord struct {
	ID          string          `json:"id" db:"id"`
	Name        string          `json:"name" db:"name"`
	Handle      string          `json:"handle" db:"handle"`
	Gender      string          `json:"gender" db:"gender"`
	Description string          `json:"description" db:"description"`
	Tags        []string        `json:"tags" db:"tags"`
	SpecJSON    json.RawMessage `json:"spec_json,omitempty" db:"spec_json"`
	AnchorURL   string          `json:"anchor_url,omitempty" db:"anchor_url"`
	AvatarURL   string          `json:"avatar_url,omitempty" db:"avatar_url"`
	BannerURL   string          `json:"banner_url,omitempty" db:"banner_url"`
	ImageURLs   []string        `json:"image_urls" db:"image_urls"`
	VideoURLs   []string        `json:"video_urls" db:"video_urls"`
	Status      string          `json:"status" db:"status"`
	CreatedAt   time.Time       `json:"created_at" db:"created_at"`
}

// PersonaStore provides read/write access to persona records for the generation pipeline.
type PersonaStore interface {
	// GetByID returns a persona by ID.
	GetByID(ctx context.Context, id string) (*PersonaRecord, error)

	// Update persists changes to an existing persona record.
	Update(ctx context.Context, persona *PersonaRecord) error
}
