/**
 * Types for the Behavioral Rules Engine.
 * Structured rules extracted from user corrections and confirmations.
 */

export interface BehaviorRule {
  /** Unique identifier */
  id: string
  /** When this rule applies: "when editing test files", "when creating components" */
  trigger: string
  /** What to do: "use integration tests, not mocks", "prefer named exports" */
  action: string
  /** Scope context: file path pattern, module name, or "global" */
  context: string
  /** Confidence score 0.0-1.0, decays over time */
  confidence: number
  /** How the rule was learned */
  source: 'correction' | 'confirmation' | 'explicit'
  /** When the rule was created */
  createdAt: number
  /** When the rule was last reinforced */
  lastReinforcedAt: number
}

export interface BehaviorRulesState {
  version: 1
  rules: BehaviorRule[]
}

export function createFreshRulesState(): BehaviorRulesState {
  return {
    version: 1,
    rules: [],
  }
}
