// Comments and related data.
// Field 	Type 	Description
// commentable_meta 	CommentableMeta[] 	ID of the object the comment is attached to
// comments 	Comment[] 	Array of comments ordered according to sort;
// cursor 	Cursor
// has_more 	boolean 	If there are more comments or replies available
// has_more_id 	integer?
// included_comments 	Comment[] 	Related comments; e.g. parent comments and nested replies
// pinned_comments 	Comment[]? 	Pinned comments
// sort 	string 	one of the CommentSort types
// top_level_count 	integer? 	Number of comments at the top level. Not returned for replies.
// total 	integer? 	Total number of comments. Not retuned for replies.
// user_follow 	boolean 	is the current user watching the comment thread?
// user_votes 	integer[] 	IDs of the comments in the bundle the current user has upvoted
// users 	User[] 	array of users related to the comments

use serde::{Deserialize, Serialize};

use crate::v2::model::comment::structs::comment::Comment;
use crate::v2::model::comment::structs::meta::CommentableMeta;
use crate::v2::model::comment::structs::user::User;

#[cfg_attr(feature = "export", derive(tsify::Tsify))]
#[cfg_attr(feature = "export", tsify(into_wasm_abi, from_wasm_abi))]
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CommentBundle {
    pub commentable_meta: Option<Vec<CommentableMeta>>,
    pub comments: Vec<Comment>,
    #[cfg_attr(feature = "export", tsify(type = "CursorInCommentBundle | null"))]
    pub cursor: Option<Cursor>,
    pub has_more: bool,
    pub has_more_id: Option<u32>,
    pub included_comments: Vec<Comment>,
    pub pinned_comments: Option<Vec<Comment>>,
    pub sort: String,
    pub top_level_count: Option<u32>,
    pub total: Option<u32>,
    pub user_follow: bool,
    pub user_votes: Vec<u32>,
    #[cfg_attr(feature = "export", tsify(type = "UserInCommentBundle[]"))]
    pub users: Vec<User>,
}

#[cfg_attr(feature = "export", derive(tsify::Tsify))]
#[cfg_attr(
    feature = "export",
    tsify(into_wasm_abi, from_wasm_abi, type_suffix = "InCommentBundle")
)]
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Cursor {
    pub created_at: Option<String>,
    pub id: Option<u32>,
}
