import Testing

@testable import NucleicCore

/// `BackendID.forModel` is the single source of truth that lets the model picker double as
/// the backend selector — and, in the UI layer, drives the per-model effort cap + the
/// "Reasoning"/"Effort" label. Lock the mapping.
@Suite struct BackendRoutingTests {
    @Test func claudeModelsRouteToClaudeCode() {
        #expect(BackendID.forModel("claude-opus-4-8[1m]") == .claudeCode)
        #expect(BackendID.forModel("claude-opus-4-8") == .claudeCode)
        #expect(BackendID.forModel("claude-sonnet-4-6") == .claudeCode)
        #expect(BackendID.forModel("claude-haiku-4-5") == .claudeCode)
    }

    @Test func gptAndCodexModelsRouteToCodex() {
        #expect(BackendID.forModel("gpt-5.5") == .codex)
        #expect(BackendID.forModel("gpt-5.4-mini") == .codex)
        #expect(BackendID.forModel("o3") == .codex)
        #expect(BackendID.forModel("gpt-5-codex") == .codex)
        #expect(BackendID.forModel("GPT-5.5") == .codex)  // case-insensitive
    }

    @Test func unknownModelIsUnclassified() {
        #expect(BackendID.forModel("mystery-model") == nil)
        #expect(BackendID.forModel(nil) == nil)
    }
}
