package domain

import "time"

// Feedback records what was learned from an execution.
type Feedback struct {
	EntityID              UUID
	ExecutionID           UUID
	Outcome               string
	Observation           string
	Lesson                string
	UnexpectedSideEffects []string
	Tags                  []string
	CreatedAt             time.Time
}

// Feedback outcomes.
const (
	OutcomeSuccess    = "success"
	OutcomeFailure    = "failure"
	OutcomePartial    = "partial"
	OutcomeUnexpected = "unexpected"
)

// Pattern is a generalized rule extracted from accumulated feedback.
type Pattern struct {
	EntityID         UUID
	AppliesType      string
	Action           string
	Pattern          string
	Confidence       float64
	EvidenceCount    int
	SuccessCount     int
	FailureCount     int
	Status           string
	Quarantined      bool
	Version          int
	LastValidatedAt  *time.Time
	CreatedAt        time.Time
}

// Pattern lifecycle states.
const (
	PatternHypothesized = "hypothesized"
	PatternValidated    = "validated"
	PatternActive       = "active"
	PatternDeprecated   = "deprecated"
	PatternInvalidated  = "invalidated"
)

// Skill is a codified procedure refined through validated patterns.
type Skill struct {
	EntityID     UUID
	Version      int
	Name         string
	Procedure    map[string]any
	AppliesType  string
	Action       string
	PatternIDs   []UUID
	Status       string
	SuccessRate  float64
	ChangedBy    UUID
	ChangeReason string
	LastUsedAt   *time.Time
	CreatedAt    time.Time
}

// Skill lifecycle states.
const (
	SkillDrafted   = "drafted"
	SkillTested    = "tested"
	SkillActive    = "active"
	SkillRefined   = "refined"
	SkillDeprecated = "deprecated"
	SkillFailed    = "failed"
)
