//! Google Gemini API client and Rig integration
//!
//! # Example
//! ```no_run
//! use rig_core::{client::EmbeddingsClient, providers::gemini};
//!
//! # fn run() -> Result<(), Box<dyn std::error::Error>> {
//! let client = gemini::Client::new("YOUR_API_KEY")?;
//!
//! let gemini_embedding_model = client.embedding_model(gemini::EMBEDDING_001);
//! # Ok(())
//! # }
//! ```

pub mod client;
pub mod completion;
pub mod embedding;
pub mod interactions_api;
pub mod model_listing;
pub mod streaming;
pub mod transcription;

pub use client::{Client, InteractionsClient};
pub use completion::CompletionModel;
pub use embedding::{EMBEDDING_001, EMBEDDING_004, EmbeddingModel};
pub use model_listing::*;

pub mod gemini_api_types {
    use serde::{Deserialize, Serialize};

    #[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
    #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
    pub enum ExecutionLanguage {
        /// Unspecified language. This value should not be used.
        LanguageUnspecified,
        /// Python >= 3.10, with numpy and simply available.
        Python,
    }

    /// Code generated by the model that is meant to be executed, and the result returned to the model.
    /// Only generated when using the CodeExecution tool, in which the code will be automatically executed,
    /// and a corresponding CodeExecutionResult will also be generated.
    #[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
    pub struct ExecutableCode {
        /// Programming language of the code.
        pub language: ExecutionLanguage,
        /// The code to be executed.
        pub code: String,
    }
    #[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
    pub struct CodeExecutionResult {
        /// Outcome of the code execution.
        pub outcome: CodeExecutionOutcome,
        /// Contains stdout when code execution is successful, stderr or other description otherwise.
        #[serde(skip_serializing_if = "Option::is_none")]
        pub output: Option<String>,
    }

    #[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
    pub enum CodeExecutionOutcome {
        /// Unspecified status. This value should not be used.
        #[serde(rename = "OUTCOME_UNSPECIFIED")]
        Unspecified,
        /// Code execution completed successfully.
        #[serde(rename = "OUTCOME_OK")]
        Ok,
        /// Code execution finished but with a failure. stderr should contain the reason.
        #[serde(rename = "OUTCOME_FAILED")]
        Failed,
        /// Code execution ran for too long, and was cancelled. There may or may not be a partial output present.
        #[serde(rename = "OUTCOME_DEADLINE_EXCEEDED")]
        DeadlineExceeded,
    }
}
