/*
 * 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};

/// ExternalPostSummary : A post synced from a platform (published directly on the platform, not through Zernio). Returned by GET /v1/posts?source=external and POST /v1/posts/sync-external. Analytics are exposed separately via GET /v1/analytics?source=external.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ExternalPostSummary {
    /// Platform the post belongs to (e.g. instagram, youtube, tiktok)
    #[serde(rename = "platform", skip_serializing_if = "Option::is_none")]
    pub platform: Option<String>,
    /// The platform's own post/media/video id
    #[serde(rename = "platformPostId", skip_serializing_if = "Option::is_none")]
    pub platform_post_id: Option<String>,
    /// Canonical URL (permalink) of the post on the platform
    #[serde(rename = "platformPostUrl", skip_serializing_if = "Option::is_none")]
    pub platform_post_url: Option<String>,
    /// Post caption / text
    #[serde(rename = "content", skip_serializing_if = "Option::is_none")]
    pub content: Option<String>,
    /// When the post was published on the platform
    #[serde(rename = "publishedAt", skip_serializing_if = "Option::is_none")]
    pub published_at: Option<String>,
    /// Media type (e.g. image, video, carousel)
    #[serde(rename = "mediaType", skip_serializing_if = "Option::is_none")]
    pub media_type: Option<String>,
    /// Primary media URL
    #[serde(rename = "mediaUrl", skip_serializing_if = "Option::is_none")]
    pub media_url: Option<String>,
    /// Thumbnail URL
    #[serde(rename = "thumbnailUrl", skip_serializing_if = "Option::is_none")]
    pub thumbnail_url: Option<String>,
    /// Per-item media (for carousels / multi-media posts)
    #[serde(rename = "mediaItems", skip_serializing_if = "Option::is_none")]
    pub media_items: Option<Vec<serde_json::Value>>,
    #[serde(rename = "analytics", skip_serializing_if = "Option::is_none")]
    pub analytics: Option<Box<models::ExternalPostSummaryAnalytics>>,
}

impl ExternalPostSummary {
    /// A post synced from a platform (published directly on the platform, not through Zernio). Returned by GET /v1/posts?source=external and POST /v1/posts/sync-external. Analytics are exposed separately via GET /v1/analytics?source=external.
    pub fn new() -> ExternalPostSummary {
        ExternalPostSummary {
            platform: None,
            platform_post_id: None,
            platform_post_url: None,
            content: None,
            published_at: None,
            media_type: None,
            media_url: None,
            thumbnail_url: None,
            media_items: None,
            analytics: None,
        }
    }
}
