use super::media::MediaPlaybackMetrics;
use serde::Deserialize;

/// Non-public metrics are metrics’ totals that are not available for anyone to view on Twitter, such as number of impressions and video view quartiles.
///
/// This requires an authenticated user!
#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize)]
pub struct NonPublicMetrics {
	impression_count: u64,
	url_link_clicks: u64,
	user_profile_clicks: u64,
	#[serde(flatten)]
	media_playback: Option<MediaPlaybackMetrics>,
}

impl NonPublicMetrics {
	/// A count of how many times the Tweet has been viewed (not unique by user).
	/// A view is counted if any part of the Tweet is visible on the screen.
	#[inline]
	pub fn impression_count(&self) -> u64 {
		self.impression_count
	}

	/// A count of the number of times a user clicks on a URL link or URL preview card in a Tweet.
	#[inline]
	pub fn url_link_clicks(&self) -> u64 {
		self.url_link_clicks
	}

	/// A count of the number of times a user clicks the following portions of a Tweet: display name, user name, profile picture.
	#[inline]
	pub fn user_profile_clicks(&self) -> u64 {
		self.user_profile_clicks
	}

	/// Metrics on how many users have watched how much of the video.
	#[inline]
	pub fn media_playback(&self) -> Option<MediaPlaybackMetrics> {
		self.media_playback
	}
}
