package de.gecheckt.pdf.umbenenner.adapter.in.gui.editor;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatNullPointerException;

import org.junit.jupiter.api.Test;

/**
 * Tests for {@link GuiManualModelEntry}.
 */
class GuiManualModelEntryTest {

    @Test
    void storesProviderIdentifierAndModelName() {
        var entry = new GuiManualModelEntry("claude", "claude-3-5-sonnet");

        assertThat(entry.providerIdentifier()).isEqualTo("claude");
        assertThat(entry.modelName()).isEqualTo("claude-3-5-sonnet");
    }

    @Test
    void hasModelName_trueWhenNonBlank() {
        assertThat(new GuiManualModelEntry("claude", "some-model").hasModelName()).isTrue();
    }

    @Test
    void hasModelName_falseWhenBlank() {
        assertThat(new GuiManualModelEntry("claude", "").hasModelName()).isFalse();
        assertThat(new GuiManualModelEntry("claude", "   ").hasModelName()).isFalse();
    }

    @Test
    void rejectsNullProviderIdentifier() {
        assertThatNullPointerException()
                .isThrownBy(() -> new GuiManualModelEntry(null, "model"));
    }

    @Test
    void rejectsNullModelName() {
        assertThatNullPointerException()
                .isThrownBy(() -> new GuiManualModelEntry("claude", null));
    }

    @Test
    void equality_basedOnAllFields() {
        var a = new GuiManualModelEntry("claude", "model-x");
        var b = new GuiManualModelEntry("claude", "model-x");
        var c = new GuiManualModelEntry("openai-compatible", "model-x");

        assertThat(a).isEqualTo(b);
        assertThat(a).isNotEqualTo(c);
    }
}
