use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
#[derive(Debug, Clone, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct ExploreEntry {
pub title: String,
pub vars: BTreeMap<String, String>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
pub struct Chapter {
pub title: String,
pub url: String,
#[serde(default)]
pub is_volume: bool,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
pub struct Volume {
pub title: String,
pub first_chapter_index: usize,
}
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct Toc {
pub chapters: Vec<Chapter>,
pub volumes: Vec<Volume>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
pub struct BookInfo {
pub name: String,
pub author: String,
pub cover: String,
pub intro: String,
pub kind: String,
pub last_chapter: String,
pub toc_url: String,
pub word_count: String,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
pub struct BookListItem {
#[serde(flatten)]
pub info: BookInfo,
pub book_url: String,
}
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct BookList {
pub items: Vec<BookListItem>,
pub total_pages: Option<u32>,
pub has_more: Option<bool>,
}
impl BookList {
pub fn new(items: Vec<BookListItem>) -> Self {
Self {
items,
total_pages: None,
has_more: None,
}
}
}