package domain

import (
	"encoding/json"
	"time"
)

// PersonaID is a strongly-typed identifier for personas.
type PersonaID string

// String returns the string representation of the ID.
func (id PersonaID) String() string {
	return string(id)
}

// IsZero returns true if the ID is empty.
func (id PersonaID) IsZero() bool {
	return id == ""
}

// PersonaStatus represents the current generation state of a persona.
type PersonaStatus string

const (
	PersonaStatusPending    PersonaStatus = "pending"
	PersonaStatusGenerating PersonaStatus = "generating"
	PersonaStatusComplete   PersonaStatus = "complete"
	PersonaStatusFailed     PersonaStatus = "failed"
)

// PersonaStage represents a generation pipeline stage.
type PersonaStage string

const (
	StageSpec         PersonaStage = "spec"
	StageAnchor       PersonaStage = "anchor"
	StageAvatar       PersonaStage = "avatar"
	StageBanner       PersonaStage = "banner"
	StageGalleryBatch PersonaStage = "gallery_batch"
	StageVideo        PersonaStage = "video"
)

// Persona represents an AI-generated persona.
type Persona struct {
	ID          PersonaID       `json:"id"`
	Name        string          `json:"name"`
	Handle      string          `json:"handle"`
	Gender      string          `json:"gender"`
	Description string          `json:"description"`
	Tags        []string        `json:"tags"`
	SpecJSON    json.RawMessage `json:"spec_json,omitempty"`
	AnchorURL   string          `json:"anchor_url,omitempty"`
	AvatarURL   string          `json:"avatar_url,omitempty"`
	BannerURL   string          `json:"banner_url,omitempty"`
	ImageURLs   []string        `json:"image_urls"`
	VideoURLs   []string        `json:"video_urls"`
	Status      PersonaStatus   `json:"status"`
	CreatedAt   time.Time       `json:"created_at"`
}

// PersonaGenerateJob represents a queued persona generation job payload.
type PersonaGenerateJob struct {
	PersonaID string `json:"persona_id"`
	Stage     string `json:"stage"`
}
