use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::path::PathBuf;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum WikiError {
#[error("HTTP error: {0}")]
Http(#[from] reqwest::Error),
#[error("Parse error: {0}")]
Parse(String),
#[error("Cache error: {0}")]
Cache(String),
#[error("Not found: {0}")]
NotFound(String),
}
#[allow(dead_code)]
pub struct WikiClient {
client: reqwest::Client,
cache_dir: PathBuf,
base_url: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SkillGem {
pub name: String,
pub tags: Vec<String>,
pub description: String,
pub base_damage: Option<DamageInfo>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DamageInfo {
pub min: f64,
pub max: f64,
pub damage_type: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UniqueItem {
pub name: String,
pub base_type: String,
pub modifiers: Vec<String>,
pub requirements: HashMap<String, i32>,
}
impl WikiClient {
pub fn new(cache_dir: PathBuf) -> Self {
Self {
client: reqwest::Client::new(),
cache_dir,
base_url: "https://www.poewiki.net/wiki/".to_owned(),
}
}
pub async fn get_skill(&self, name: &str) -> Result<SkillGem, WikiError> {
tracing::debug!("Fetching skill: {}", name);
Err(WikiError::NotFound(name.to_owned()))
}
pub async fn get_unique(&self, name: &str) -> Result<UniqueItem, WikiError> {
tracing::debug!("Fetching unique: {}", name);
Err(WikiError::NotFound(name.to_owned()))
}
pub async fn search(&self, query: &str) -> Result<Vec<String>, WikiError> {
tracing::debug!("Searching wiki for: {}", query);
Ok(Vec::new())
}
pub fn clear_cache(&self) -> Result<(), WikiError> {
Ok(())
}
}