// Copyright 2026 Cloudflavor GmbH

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(test)]
mod tests {
    use oai_sdk::ModelClient;

    #[tokio::test]
    async fn test_client_creation() {
        let client = ModelClient::builder()
            .base_url("http://localhost:11434".to_string())
            .build()
            .unwrap();

        // Test that we can get the version
        match client.get_version().await {
            Ok(version) => println!("Ollama version: {}", version.version),
            Err(_) => println!("Could not connect to Ollama, but client creation works"),
        }
    }

    #[tokio::test]
    async fn test_list_models() {
        let client = ModelClient::builder()
            .base_url("http://localhost:11434".to_string())
            .build()
            .unwrap();

        match client.list_models().await {
            Ok(models) => {
                println!("Found {} models", models.len());
                for model in models {
                    println!("  - {} ({})", model.name, model.details.parameter_size);
                }
            }
            Err(_) => println!("Could not list models, but client works"),
        }
    }
}
