/// An update to apply to a single video dataset file backing a channel. Only the provided fields are
/// changed; at least one must be set. When both start and scaleParameter are set, the file is rescaled
/// first (around its current start) and then shifted to the new start.
#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    conjure_object::private::DeriveWith
)]
#[serde(crate = "conjure_object::serde")]
#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct VideoChannelDatasetFileUpdate {
    #[serde(rename = "datasetFileId")]
    dataset_file_id: conjure_object::Uuid,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::super::super::super::api::Timestamp>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "start", skip_serializing_if = "Option::is_none", default)]
    start: Option<Box<super::super::super::super::api::Timestamp>>,
    #[builder(default, into)]
    #[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
    title: Option<String>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::ScaleParameter>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "scaleParameter", skip_serializing_if = "Option::is_none", default)]
    scale_parameter: Option<Box<super::ScaleParameter>>,
}
impl VideoChannelDatasetFileUpdate {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(dataset_file_id: conjure_object::Uuid) -> Self {
        Self::builder().dataset_file_id(dataset_file_id).build()
    }
    #[inline]
    pub fn dataset_file_id(&self) -> conjure_object::Uuid {
        self.dataset_file_id
    }
    /// New absolute start timestamp for the file. The file's earliest segment is shifted to this
    /// timestamp and every other segment in the file is shifted by the same offset.
    #[inline]
    pub fn start(&self) -> Option<&super::super::super::super::api::Timestamp> {
        self.start.as_ref().map(|o| &**o)
    }
    /// New name (title) for the dataset file.
    #[inline]
    pub fn title(&self) -> Option<&str> {
        self.title.as_ref().map(|o| &**o)
    }
    /// Rescales the file's frame timestamps around its start (e.g. a corrected true frame rate, an
    /// absolute ending timestamp, or a direct scale factor). The file's cached segment metadata
    /// (scale factor, frame rate) is recomputed.
    #[inline]
    pub fn scale_parameter(&self) -> Option<&super::ScaleParameter> {
        self.scale_parameter.as_ref().map(|o| &**o)
    }
}
