use crate::AppConfig;

impl AppConfig {
    pub fn get_embed_model_base_url(&self) -> anyhow::Result<String> {
        if let Some(url) = self.env.get("APP_EMBED_MODEL_BASE_URL") {
            return Ok(url.to_string());
        }
        Err(anyhow::anyhow!("APP_EMBED_MODEL_BASE_URL not found"))
    }
    pub fn get_embed_model_dimensions(&self) -> anyhow::Result<u64> {
        if let Some(dimensions) = self.env.get("APP_EMBED_MODEL_DIMENSIONS") {
            return Ok(dimensions.parse::<u64>()?);
        }
        Err(anyhow::anyhow!("APP_EMBED_MODEL_DIMENSIONS not found"))
    }
    pub fn get_embed_model_api_key(&self) -> anyhow::Result<String> {
        if let Some(api_key) = self.env.get("APP_EMBED_MODEL_API_KEY") {
            return Ok(api_key.to_string());
        }
        Err(anyhow::anyhow!("APP_EMBED_MODEL_API_KEY not found"))
    }
    pub fn get_embed_model_name(&self) -> anyhow::Result<String> {
        if let Some(model_name) = self.env.get("APP_EMBED_MODEL_NAME") {
            return Ok(model_name.to_string());
        }
        Err(anyhow::anyhow!("APP_EMBED_MODEL_NAME not found"))
    }
    pub fn get_qdrant_url(&self) -> anyhow::Result<String> {
        if let Some(url) = self.env.get("APP_QDRANT_URL") {
            return Ok(url.to_string());
        }
        Err(anyhow::anyhow!("APP_QDRANT_URL not found"))
    }
    pub fn get_qdrant_api_key(&self) -> Option<String> {
        self.env.get("APP_QDRANT_API_KEY").map(|s| s.to_string())
    }
}
