use std::str::FromStr;
use crate::helper::SubscriptionPlan;
use super::{
Banner, Chapter, ChapterGroup, Label, Language, PublisherItem, Tag, TitleUpdateStatus,
UserSubscription, UserTickets,
};
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Title {
#[prost(uint64, tag = "1")]
pub id: u64,
#[prost(string, tag = "2")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub author: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub portrait: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub landscape: ::prost::alloc::string::String,
#[prost(uint64, tag = "6")]
pub view_count: u64,
#[prost(enumeration = "Language", tag = "7")]
pub language: i32,
#[prost(enumeration = "TitleUpdateStatus", tag = "8")]
pub status: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TitleDetail {
#[prost(message, tag = "1")]
pub title: ::core::option::Option<Title>,
#[prost(string, tag = "2")]
pub image: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub overview: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub background_image: ::prost::alloc::string::String,
#[prost(int64, optional, tag = "5")]
pub next_update: ::core::option::Option<i64>,
#[prost(uint64, optional, tag = "6")]
pub update_frequency: ::core::option::Option<u64>,
#[prost(string, optional, tag = "7")]
pub viewing_period: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "8")]
pub non_appearance_message: ::core::option::Option<::prost::alloc::string::String>,
#[prost(message, repeated, tag = "9")]
pub first_chapters: ::prost::alloc::vec::Vec<Chapter>,
#[prost(message, repeated, tag = "10")]
pub last_chapters: ::prost::alloc::vec::Vec<Chapter>,
#[prost(message, repeated, tag = "11")]
pub banners: ::prost::alloc::vec::Vec<Banner>,
#[prost(message, repeated, tag = "12")]
pub recommended_titles: ::prost::alloc::vec::Vec<Title>,
#[prost(bool, tag = "14")]
pub simulpublish: bool,
#[prost(bool, tag = "15")]
pub subscribed: bool,
#[prost(enumeration = "super::TitleRating", tag = "16")]
pub rating: i32,
#[prost(bool, tag = "17")]
pub descending: bool,
#[prost(uint64, tag = "18")]
pub view_count: u64,
#[prost(message, repeated, tag = "19")]
pub publishers: ::prost::alloc::vec::Vec<PublisherItem>,
#[prost(message, repeated, tag = "20")]
pub title_banners: ::prost::alloc::vec::Vec<Banner>,
#[prost(message, optional, tag = "21")]
pub user_tickets: ::core::option::Option<UserTickets>,
#[prost(message, repeated, tag = "22")]
pub ticket_chapters: ::prost::alloc::vec::Vec<Chapter>,
#[prost(message, repeated, tag = "23")]
pub ticket_titles: ::prost::alloc::vec::Vec<Title>,
#[prost(bool, tag = "24")]
pub has_in_between: bool,
#[prost(message, optional, tag = "25")]
pub publisher_banner: ::core::option::Option<Banner>,
#[prost(message, repeated, tag = "27")]
pub other_languages: ::prost::alloc::vec::Vec<TitleLanguages>,
#[prost(message, repeated, tag = "28")]
pub chapter_groups: ::prost::alloc::vec::Vec<ChapterGroup>,
#[prost(string, tag = "30")]
pub region_code: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "31")]
pub tags: ::prost::alloc::vec::Vec<Tag>,
#[prost(message, tag = "32")]
pub title_labels: ::core::option::Option<TitleLabels>,
#[prost(message, optional, tag = "33")]
pub user_subscription: ::core::option::Option<UserSubscription>,
#[prost(message, optional, tag = "34")]
pub label: ::core::option::Option<Label>,
#[prost(bool, tag = "35")]
pub first_time_free: bool,
}
impl TitleDetail {
pub fn flat_chapters_group(&self) -> Vec<Chapter> {
self.chapter_groups
.iter()
.flat_map(|group| group.flatten())
.collect()
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TitleLanguages {
#[prost(uint64, tag = "1")]
pub id: u64,
#[prost(enumeration = "Language", tag = "2")]
pub language: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TitleLabels {
#[prost(enumeration = "super::TitleReleaseSchedule", tag = "1")]
pub release_schedule: i32,
#[prost(bool, tag = "2")]
pub simulpublish: bool,
#[prost(string, tag = "3")]
pub plan_type: ::prost::alloc::string::String,
}
impl TitleLabels {
pub fn plan_type(&self) -> SubscriptionPlan {
match SubscriptionPlan::from_str(&self.plan_type) {
Ok(plan) => plan,
Err(_) => SubscriptionPlan::Basic,
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TitleList {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub titles: ::prost::alloc::vec::Vec<Title>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TitleListV2 {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub titles: ::prost::alloc::vec::Vec<Title>,
#[prost(message, repeated, tag = "3")]
pub tags: ::prost::alloc::vec::Vec<Tag>,
#[prost(message, optional, tag = "4")]
pub label: ::core::option::Option<Label>,
#[prost(int64, optional, tag = "5")]
pub next_start_at: ::core::option::Option<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TitleListOnly {
#[prost(message, repeated, tag = "1")]
pub titles: ::prost::alloc::vec::Vec<Title>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TitleListOnlyV2 {
#[prost(message, repeated, tag = "1")]
pub titles: ::prost::alloc::vec::Vec<TitleListV2>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdatedTitle {
#[prost(message, tag = "1")]
pub title: ::core::option::Option<Title>,
#[prost(uint64, tag = "2")]
pub chapter_id: u64,
#[prost(string, optional, tag = "3")]
pub chapter_title: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, optional, tag = "4")]
pub chapter_subtitle: ::core::option::Option<::prost::alloc::string::String>,
#[prost(bool, tag = "5")]
pub latest: bool,
#[prost(bool, tag = "6")]
pub long_strip_only: bool,
#[prost(bool, tag = "7")]
pub horizontal_only: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdatedTitleGroup {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub titles: ::prost::alloc::vec::Vec<UpdatedTitle>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdatedTitleList {
#[prost(message, repeated, tag = "1")]
pub updates: ::prost::alloc::vec::Vec<UpdatedTitleGroup>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdatedTitleGroupOriginal {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub chapter_number: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub titles: ::prost::alloc::vec::Vec<UpdatedTitle>,
#[prost(uint64, tag = "4")]
pub view_count: u64,
#[prost(enumeration = "TitleUpdateStatus", tag = "5")]
pub status: i32,
#[prost(int64, tag = "6")]
pub start_at: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdatedTitleGroupV2 {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub titles: ::prost::alloc::vec::Vec<UpdatedTitleGroupOriginal>,
#[prost(uint64, tag = "3")]
pub days: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FeaturedTitleContents {
#[prost(message, optional, tag = "1")]
pub banner: ::core::option::Option<Banner>,
#[prost(message, optional, tag = "2")]
pub titles: ::core::option::Option<TitleList>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FeaturedTitles {
#[prost(message, optional, tag = "1")]
pub main: ::core::option::Option<Banner>,
#[prost(message, optional, tag = "2")]
pub sub1: ::core::option::Option<Banner>,
#[prost(message, optional, tag = "3")]
pub sub2: ::core::option::Option<Banner>,
#[prost(message, repeated, tag = "4")]
pub contents: ::prost::alloc::vec::Vec<FeaturedTitleContents>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FeaturedTitleContentsV2 {
#[prost(message, optional, tag = "1")]
pub banner: ::core::option::Option<Banner>,
#[prost(message, optional, tag = "2")]
pub titles: ::core::option::Option<TitleList>,
#[prost(message, repeated, tag = "3")]
pub ranked_titles: ::prost::alloc::vec::Vec<TitleRankingGroup>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FeaturedTitlesV2 {
#[prost(message, repeated, tag = "1")]
pub banners: ::prost::alloc::vec::Vec<Banner>,
#[prost(message, repeated, tag = "4")]
pub contents: ::prost::alloc::vec::Vec<FeaturedTitleContentsV2>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribedTitle {
#[prost(message, tag = "1")]
pub title: ::core::option::Option<Title>,
#[prost(bool, tag = "2")]
pub latest: bool,
#[prost(bool, tag = "3")]
pub subscribed: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpcomingChapterTitle {
#[prost(message, tag = "1")]
pub title: ::core::option::Option<Title>,
#[prost(string, tag = "2")]
pub chapter_name: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub release_at: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TitleUpdated {
#[prost(message, tag = "1")]
pub title: ::core::option::Option<Title>,
#[prost(string, tag = "2")]
pub updated_at: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TitleUpdatedV2 {
#[prost(message, repeated, tag = "1")]
pub titles: ::prost::alloc::vec::Vec<TitleListV2>,
#[prost(string, tag = "2")]
pub updated_at: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TitleUpdates {
#[prost(message, repeated, tag = "1")]
pub updates: ::prost::alloc::vec::Vec<TitleUpdated>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TitleUpdatesV2 {
#[prost(message, repeated, tag = "1")]
pub updates: ::prost::alloc::vec::Vec<TitleUpdatedV2>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TitleTicket {
#[prost(message, tag = "1")]
pub title: ::core::option::Option<Title>,
#[prost(uint64, tag = "2")]
pub first_chapter: u64,
#[prost(uint64, tag = "3")]
pub last_chapter: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TitleTicketList {
#[prost(message, repeated, tag = "1")]
pub titles: ::prost::alloc::vec::Vec<TitleTicket>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HighlightedTitle {
#[prost(message, tag = "1")]
pub title: ::core::option::Option<Title>,
#[prost(uint64, tag = "2")]
pub chapter_id: u64,
#[prost(string, repeated, tag = "3")]
pub pages: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(uint64, tag = "4")]
pub height: u64,
#[prost(uint64, tag = "5")]
pub width: u64,
#[prost(bool, tag = "6")]
pub vertical_only: bool,
#[prost(bool, tag = "7")]
pub horizontal_only: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FreeTitle {
#[prost(message, tag = "1")]
pub title: ::core::option::Option<Title>,
#[prost(string, tag = "2")]
pub updated_at: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FreeTitles {
#[prost(message, repeated, tag = "1")]
pub titles: ::prost::alloc::vec::Vec<FreeTitle>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LabelledTitle {
#[prost(string, tag = "1")]
pub label: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub titles: ::prost::alloc::vec::Vec<Title>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LabelledTitles {
#[prost(message, tag = "1")]
pub label: ::core::option::Option<Label>,
#[prost(message, repeated, tag = "2")]
pub labels: ::prost::alloc::vec::Vec<LabelledTitle>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TitleRankingGroup {
#[prost(uint64, tag = "1")]
pub original_title: u64,
#[prost(message, repeated, tag = "2")]
pub titles: ::prost::alloc::vec::Vec<Title>,
#[prost(uint64, tag = "3")]
pub ranking: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TitleRankingList {
#[prost(message, repeated, tag = "1")]
pub banners: ::prost::alloc::vec::Vec<Banner>,
#[prost(int64, tag = "2")]
pub updated_at: i64,
#[prost(message, repeated, tag = "3")]
pub titles: ::prost::alloc::vec::Vec<TitleRankingGroup>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscriptionTitles {
#[prost(string, tag = "1")]
pub plan: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub titles: ::prost::alloc::vec::Vec<Title>,
}
impl SubscriptionTitles {
pub fn plan(&self) -> SubscriptionPlan {
match SubscriptionPlan::from_str(&self.plan) {
Ok(plan) => plan,
Err(_) => SubscriptionPlan::Basic,
}
}
}