docterm 0.2.0

A TUI-first documentation browser for Dash/Zeal docsets, optimized for the terminal.
use serde::{Deserialize, Serialize};

/// An installed docset.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Docset {
    pub id: i64,
    pub name: String,
    pub version: Option<String>,
    /// Local path to the source archive or extracted directory.
    pub path: Option<String>,
    pub is_favorite: bool,
}

/// Lightweight search entry used by Nucleo and the lateral list.
#[derive(Debug, Clone)]
pub struct SearchEntry {
    pub id: i64,
    pub docset_id: i64,
    pub name: String,
    pub entry_type: String,
    pub path: String,
    pub usage_count: i32,
    pub docset_name: String,
    pub docset_version: Option<String>,
}

/// Decompressed page content ready for rendering with termimad.
#[derive(Debug, Clone)]
pub struct PageContent {
    pub markdown: String,
}

/// A bookmarked documentation entry persisted in the database.
#[derive(Debug, Clone)]
pub struct FavoriteEntry {
    pub entry_id: i64,
    pub entry_name: String,
    pub entry_type: String,
    pub entry_path: String,
    pub docset_id: i64,
    pub docset_name: String,
}

// for fetch purpose

/// A single docset entry from the bundled source list.
#[derive(Debug, Clone, Deserialize)]
pub struct DocsetEntry {
    /// Docset name
    pub name: String,
    /// Available version to download
    pub version: String,
    /// Available URLs, if more than 1 we have mirrors
    pub urls: Vec<String>,
}

#[derive(Deserialize)]
pub struct SourceList {
    pub source: Vec<DocsetEntry>,
}