/// Request to get a segment by timestamp for a video series.
#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct GetSegmentByTimestampV2Request {
    #[builder(custom(type = super::VideoChannelSeries, convert = Box::new))]
    #[serde(rename = "channelSeries")]
    channel_series: Box<super::VideoChannelSeries>,
    #[builder(
        custom(type = super::super::super::super::api::Timestamp, convert = Box::new)
    )]
    #[serde(rename = "timestamp")]
    timestamp: Box<super::super::super::super::api::Timestamp>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::super::super::super::api::Timestamp>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "viewRangeStart", skip_serializing_if = "Option::is_none", default)]
    view_range_start: Option<Box<super::super::super::super::api::Timestamp>>,
}
impl GetSegmentByTimestampV2Request {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        channel_series: super::VideoChannelSeries,
        timestamp: super::super::super::super::api::Timestamp,
    ) -> Self {
        Self::builder().channel_series(channel_series).timestamp(timestamp).build()
    }
    #[inline]
    pub fn channel_series(&self) -> &super::VideoChannelSeries {
        &*self.channel_series
    }
    #[inline]
    pub fn timestamp(&self) -> &super::super::super::super::api::Timestamp {
        &*self.timestamp
    }
    /// The start of the view range used to dynamically calculate media timestamps. The first segment with an
    /// overlap with the time bounds will have its minimum media timestamp set to 0, with every subsequent
    /// segment building media time cumulatively from that offset.
    #[inline]
    pub fn view_range_start(
        &self,
    ) -> Option<&super::super::super::super::api::Timestamp> {
        self.view_range_start.as_ref().map(|o| &**o)
    }
}
