/**
 * WP-13 — optional evidence enrichment fields (EVAL / inheritance compare).
 * Old required evidence fields are unchanged; these are additive.
 */

export interface EvidenceObservationFields {
  host_id?: string;
  adapter_kind?: string;
  adapter_version?: string;
  model_id?: string;
  binding_id?: string;
  continuity_mode?:
    | "same_session"
    | "resumed_session"
    | "new_session_from_files"
    | string;
}

export const EVIDENCE_OBSERVATION_FIELD_KEYS = [
  "host_id",
  "adapter_kind",
  "adapter_version",
  "model_id",
  "binding_id",
  "continuity_mode",
] as const;

export function pickEvidenceObservationFields(
  raw: Record<string, unknown>,
): EvidenceObservationFields {
  const out: EvidenceObservationFields = {};
  for (const key of EVIDENCE_OBSERVATION_FIELD_KEYS) {
    const v = raw[key];
    if (typeof v === "string" && v.trim()) {
      out[key] = v.trim();
    }
  }
  return out;
}
