import { FormField, Select } from '@cameleer/design-system'; import type { FormState } from './form-state'; import { RouteMetricForm } from './condition-forms/RouteMetricForm'; import { ExchangeMatchForm } from './condition-forms/ExchangeMatchForm'; import { AgentStateForm } from './condition-forms/AgentStateForm'; import { DeploymentStateForm } from './condition-forms/DeploymentStateForm'; import { LogPatternForm } from './condition-forms/LogPatternForm'; import { JvmMetricForm } from './condition-forms/JvmMetricForm'; const KIND_OPTIONS = [ { value: 'ROUTE_METRIC', label: 'Route metric (error rate, latency, throughput)' }, { value: 'EXCHANGE_MATCH', label: 'Exchange match (specific failures)' }, { value: 'AGENT_STATE', label: 'Agent state (DEAD / STALE)' }, { value: 'DEPLOYMENT_STATE', label: 'Deployment state (FAILED / DEGRADED)' }, { value: 'LOG_PATTERN', label: 'Log pattern (count of matching logs)' }, { value: 'JVM_METRIC', label: 'JVM metric (heap, GC, inflight)' }, ]; export function ConditionStep({ form, setForm }: { form: FormState; setForm: (f: FormState) => void }) { const onKindChange = (v: string) => { const kind = v as FormState['conditionKind']; // Reset the condition payload so stale fields from a previous kind don't leak // into the save request. Preserve scope — it's managed on the scope step. const prev = form.condition as Record; setForm({ ...form, conditionKind: kind, condition: { kind, scope: prev.scope } as FormState['condition'], }); }; return (