#[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 GetSegmentByTimestampRequest {
    #[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 GetSegmentByTimestampRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(timestamp: super::super::super::super::api::Timestamp) -> Self {
        Self::builder().timestamp(timestamp).build()
    }
    #[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. This will determine the starting media
    /// timestamp of the returned segment. The view range should be the same as the one requested to get the
    /// playlist and segment summaries.
    #[inline]
    pub fn view_range_start(
        &self,
    ) -> Option<&super::super::super::super::api::Timestamp> {
        self.view_range_start.as_ref().map(|o| &**o)
    }
}
