/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
 *
 * The version of the OpenAPI document: 1.0.4
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// RedditPost : A normalized Reddit post returned by the feed and search endpoints
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RedditPost {
    /// Reddit post ID (without type prefix)
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// Reddit fullname (e.g. t3_abc123)
    #[serde(rename = "fullname", skip_serializing_if = "Option::is_none")]
    pub fullname: Option<String>,
    #[serde(rename = "title", skip_serializing_if = "Option::is_none")]
    pub title: Option<String>,
    #[serde(rename = "author", skip_serializing_if = "Option::is_none")]
    pub author: Option<String>,
    #[serde(rename = "subreddit", skip_serializing_if = "Option::is_none")]
    pub subreddit: Option<String>,
    /// Post URL (may be a gallery URL
    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
    pub url: Option<String>,
    /// Full permalink to the Reddit post
    #[serde(rename = "permalink", skip_serializing_if = "Option::is_none")]
    pub permalink: Option<String>,
    /// Self-post body text (empty string for link posts)
    #[serde(rename = "selftext", skip_serializing_if = "Option::is_none")]
    pub selftext: Option<String>,
    /// Unix timestamp of post creation
    #[serde(rename = "createdUtc", skip_serializing_if = "Option::is_none")]
    pub created_utc: Option<f64>,
    #[serde(rename = "score", skip_serializing_if = "Option::is_none")]
    pub score: Option<i32>,
    #[serde(rename = "numComments", skip_serializing_if = "Option::is_none")]
    pub num_comments: Option<i32>,
    /// Whether the post is marked NSFW
    #[serde(rename = "over18", skip_serializing_if = "Option::is_none")]
    pub over18: Option<bool>,
    #[serde(rename = "stickied", skip_serializing_if = "Option::is_none")]
    pub stickied: Option<bool>,
    /// Link flair text if set
    #[serde(rename = "flairText", skip_serializing_if = "Option::is_none")]
    pub flair_text: Option<String>,
    /// Whether the post is a gallery with multiple images
    #[serde(rename = "isGallery", skip_serializing_if = "Option::is_none")]
    pub is_gallery: Option<bool>,
    /// Individual image URLs for gallery posts (only present when isGallery is true)
    #[serde(rename = "galleryImages", skip_serializing_if = "Option::is_none")]
    pub gallery_images: Option<Vec<String>>,
}

impl RedditPost {
    /// A normalized Reddit post returned by the feed and search endpoints
    pub fn new() -> RedditPost {
        RedditPost {
            id: None,
            fullname: None,
            title: None,
            author: None,
            subreddit: None,
            url: None,
            permalink: None,
            selftext: None,
            created_utc: None,
            score: None,
            num_comments: None,
            over18: None,
            stickied: None,
            flair_text: None,
            is_gallery: None,
            gallery_images: None,
        }
    }
}
