package com.doctate.watch.domain

/**
 * Outcome of the LLM oneliner generation for a single case. Mirrors
 * `common/src/oneliners.rs::OnelinerState` (Rust). Internally-tagged
 * JSON: `{"kind":"ready", ...}`. The variants are disjoint on purpose so the
 * UI can distinguish "LLM said nothing medical" (Empty) from "LLM call
 * failed" (Error) from "doctor overrode it" (Manual).
 */
sealed interface OnelinerState {
    /** Diagnostic timestamp of when this state was produced (RFC3339 UTC). */
    val timestamp: String

    /** LLM produced a usable summary. */
    data class Ready(val text: String, val generatedAt: String) : OnelinerState {
        override val timestamp: String get() = generatedAt
    }

    /** LLM deliberately returned nothing medical — valid empty result, not failure. */
    data class Empty(val generatedAt: String) : OnelinerState {
        override val timestamp: String get() = generatedAt
    }

    /** LLM call errored — recovery may retry. */
    data class Error(val generatedAt: String) : OnelinerState {
        override val timestamp: String get() = generatedAt
    }

    /** Doctor-authored override. Sticky against auto-regeneration. */
    data class Manual(val text: String, val setAt: String) : OnelinerState {
        override val timestamp: String get() = setAt
    }
}
