package com.doctate.watch.domain

import com.google.common.truth.Truth.assertThat
import org.junit.Test

class OnelinerStateExtTest {
    private val ts = "2026-04-26T10:00:00Z"

    @Test fun displayText_returns_text_for_ready() {
        val state: OnelinerState = OnelinerState.Ready("hello", ts)
        assertThat(state.displayText()).isEqualTo("hello")
    }

    @Test fun displayText_returns_text_for_manual() {
        val state: OnelinerState = OnelinerState.Manual("doctor wrote this", ts)
        assertThat(state.displayText()).isEqualTo("doctor wrote this")
    }

    @Test fun displayText_returns_null_for_empty() {
        val state: OnelinerState = OnelinerState.Empty(ts)
        assertThat(state.displayText()).isNull()
    }

    @Test fun displayText_returns_null_for_error() {
        val state: OnelinerState = OnelinerState.Error(ts)
        assertThat(state.displayText()).isNull()
    }

    @Test fun displayText_returns_null_for_null_state() {
        val state: OnelinerState? = null
        assertThat(state.displayText()).isNull()
    }

    @Test fun isManual_only_true_for_manual_variant() {
        assertThat((OnelinerState.Manual("x", ts) as OnelinerState?).isManual()).isTrue()
        assertThat((OnelinerState.Ready("x", ts) as OnelinerState?).isManual()).isFalse()
        assertThat((OnelinerState.Empty(ts) as OnelinerState?).isManual()).isFalse()
        assertThat((OnelinerState.Error(ts) as OnelinerState?).isManual()).isFalse()
        assertThat((null as OnelinerState?).isManual()).isFalse()
    }
}
