#[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 IngestRunRequest {
    #[builder(default, into)]
    #[serde(rename = "rid", skip_serializing_if = "Option::is_none", default)]
    rid: Option<conjure_object::ResourceIdentifier>,
    #[builder(into)]
    #[serde(rename = "title")]
    title: String,
    #[builder(into)]
    #[serde(rename = "description")]
    description: String,
    #[builder(custom(type = super::UtcTimestamp, convert = Box::new))]
    #[serde(rename = "startTime")]
    start_time: Box<super::UtcTimestamp>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::UtcTimestamp>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "endTime", skip_serializing_if = "Option::is_none", default)]
    end_time: Option<Box<super::UtcTimestamp>>,
    #[builder(default, map(key(type = String, into), value(type = String, into)))]
    #[serde(
        rename = "properties",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    properties: std::collections::BTreeMap<String, String>,
    #[builder(default, set(item(type = String, into)))]
    #[serde(
        rename = "labels",
        skip_serializing_if = "std::collections::BTreeSet::is_empty",
        default
    )]
    labels: std::collections::BTreeSet<String>,
    #[builder(default, into)]
    #[serde(rename = "runPrefix", skip_serializing_if = "Option::is_none", default)]
    run_prefix: Option<String>,
    #[builder(
        default,
        map(
            key(type = super::DataSourceRefName),
            value(type = super::IngestRunDataSource)
        )
    )]
    #[serde(
        rename = "dataSources",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    data_sources: std::collections::BTreeMap<
        super::DataSourceRefName,
        super::IngestRunDataSource,
    >,
    #[builder(default, into)]
    #[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
    workspace: Option<conjure_object::ResourceIdentifier>,
}
impl IngestRunRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        title: impl Into<String>,
        description: impl Into<String>,
        start_time: super::UtcTimestamp,
    ) -> Self {
        Self::builder()
            .title(title)
            .description(description)
            .start_time(start_time)
            .build()
    }
    /// If a run with the same rid already exists, the run will be updated.
    #[inline]
    pub fn rid(&self) -> Option<&conjure_object::ResourceIdentifier> {
        self.rid.as_ref().map(|o| &*o)
    }
    #[inline]
    pub fn title(&self) -> &str {
        &*self.title
    }
    #[inline]
    pub fn description(&self) -> &str {
        &*self.description
    }
    #[inline]
    pub fn start_time(&self) -> &super::UtcTimestamp {
        &*self.start_time
    }
    #[inline]
    pub fn end_time(&self) -> Option<&super::UtcTimestamp> {
        self.end_time.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn properties(&self) -> &std::collections::BTreeMap<String, String> {
        &self.properties
    }
    #[inline]
    pub fn labels(&self) -> &std::collections::BTreeSet<String> {
        &self.labels
    }
    /// for example, SIM, HTL, FLT
    #[inline]
    pub fn run_prefix(&self) -> Option<&str> {
        self.run_prefix.as_ref().map(|o| &**o)
    }
    #[inline]
    pub fn data_sources(
        &self,
    ) -> &std::collections::BTreeMap<
        super::DataSourceRefName,
        super::IngestRunDataSource,
    > {
        &self.data_sources
    }
    /// The workspace in which to create the dataset. If not provided, the dataset will be created in the default workspace for
    /// the user's organization, if the default workspace for the organization is configured.
    #[inline]
    pub fn workspace(&self) -> Option<&conjure_object::ResourceIdentifier> {
        self.workspace.as_ref().map(|o| &*o)
    }
}
