package domain

import "time"

// Classification persists every autonomous decision the classifier makes (SA5).
// This is the audit trail for "why did the OS auto-act / escalate?"
type Classification struct {
	EntityID         UUID
	SignalEntityID   UUID
	TargetEntityID   UUID
	Action           string
	RecommendedAction map[string]any
	RiskClass        string
	Route            string
	BlastRadius      []UUID
	PatternConfidence float64
	SkillID          UUID
	AutonomyCheck    string
	Reasoning        map[string]any
	CorrelationID    string
	CreatedAt        time.Time
}

// Classification routes.
const (
	RouteAutoAct   = "auto-act"
	RouteEscalate  = "escalate"
	RouteHold      = "hold"
)

// Execution is a detailed record of one action the OS performed.
type Execution struct {
	EntityID         UUID
	ClassificationID UUID
	SignalEntityID   UUID
	TargetEntityID   UUID
	Action           string
	RiskClass        string
	ApprovalID       UUID
	AgentID          UUID
	SkillID          UUID
	SkillVersion     int
	Status           string
	Result           map[string]any
	DurationMs       int
	Verified         bool
	CorrelationID    string
	StartedAt        *time.Time
	CompletedAt      *time.Time
	CreatedAt        time.Time
}

// Execution lifecycle states.
const (
	ExecProposed    = "proposed"
	ExecApproved    = "approved"
	ExecExecuting   = "executing"
	ExecVerified    = "verified"
	ExecFailed      = "failed"
	ExecTimedOut    = "timed-out"
	ExecRolledBack  = "rolled-back"
	ExecCancelled   = "cancelled"
	ExecExpired     = "expired"
)
