use serde::{Deserialize, Serialize};
use super::common::{Key, Link, TextOrValue};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Work {
pub key: String,
#[serde(default)]
pub title: Option<String>,
#[serde(default)]
pub subtitle: Option<String>,
#[serde(default)]
pub description: Option<TextOrValue>,
#[serde(default)]
pub authors: Option<Vec<WorkAuthorRef>>,
#[serde(default)]
pub subjects: Option<Vec<String>>,
#[serde(default)]
pub subject_places: Option<Vec<String>>,
#[serde(default)]
pub subject_people: Option<Vec<String>>,
#[serde(default)]
pub subject_times: Option<Vec<String>>,
#[serde(default)]
pub covers: Option<Vec<i64>>,
#[serde(default)]
pub links: Option<Vec<Link>>,
#[serde(default)]
pub first_publish_date: Option<String>,
#[serde(default)]
pub created: Option<DateValue>,
#[serde(default)]
pub last_modified: Option<DateValue>,
#[serde(default)]
pub latest_revision: Option<i64>,
#[serde(default)]
pub revision: Option<i64>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WorkAuthorRef {
pub author: Key,
#[serde(rename = "type")]
#[serde(default)]
pub role: Option<Key>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DateValue {
#[serde(rename = "type")]
pub kind: String,
pub value: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WorkEditions {
#[serde(default)]
pub entries: Vec<WorkEditionEntry>,
#[serde(default)]
pub size: Option<u64>,
#[serde(default)]
pub links: Option<super::common::PaginationLinks>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WorkEditionEntry {
pub key: String,
#[serde(default)]
pub title: Option<String>,
#[serde(default)]
pub covers: Option<Vec<i64>>,
#[serde(default)]
pub languages: Option<Vec<Key>>,
#[serde(default)]
pub publish_date: Option<String>,
#[serde(default)]
pub publishers: Option<Vec<String>>,
#[serde(default)]
pub isbn_10: Option<Vec<String>>,
#[serde(default)]
pub isbn_13: Option<Vec<String>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WorkRatings {
#[serde(default)]
pub summary: Option<RatingsSummary>,
#[serde(default)]
pub counts: Option<RatingsCounts>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RatingsSummary {
#[serde(default)]
pub average: Option<f64>,
#[serde(default)]
pub count: Option<u64>,
#[serde(default)]
pub sortable: Option<f64>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RatingsCounts {
#[serde(rename = "1", default)]
pub one: Option<u64>,
#[serde(rename = "2", default)]
pub two: Option<u64>,
#[serde(rename = "3", default)]
pub three: Option<u64>,
#[serde(rename = "4", default)]
pub four: Option<u64>,
#[serde(rename = "5", default)]
pub five: Option<u64>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WorkBookshelves {
#[serde(default)]
pub counts: Option<BookshelfCounts>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BookshelfCounts {
#[serde(default)]
pub want_to_read: Option<u64>,
#[serde(default)]
pub currently_reading: Option<u64>,
#[serde(default)]
pub already_read: Option<u64>,
}