/// Options for ingesting Avro data with the following schema. This is a "stream-like" file format to support
/// use cases where a columnar/tabular format does not make sense. This closely matches Nominal's streaming
/// API, making it useful for use cases where network connection drops during streaming and a backup file needs
/// to be created.
///
/// If this schema is not used, will result in a failed ingestion.
/// {
///     "type": "record",
///     "name": "AvroStream",
///     "namespace": "io.nominal.ingest",
///     "fields": [
///         {
///             "name": "channel",
///             "type": "string",
///             "doc": "Channel/series name (e.g., 'vehicle_id', 'col_1', 'temperature')",
///         },
///         {
///             "name": "timestamps",
///             "type": {"type": "array", "items": "long"},
///             "doc": "Array of numeric timestamps; see timestampType for interpretation",
///         },
///         {
///             "name": "values",
///             "type": {"type": "array", "items": ["double", "string"]},
///             "doc": "Array of values. Can either be doubles or strings",
///         },
///         {
///             "name": "tags",
///             "type": {"type": "map", "values": "string"},
///             "default": {},
///             "doc": "Key-value metadata tags",
///         },
///     ],
/// }
#[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 AvroStreamOpts {
    #[builder(custom(type = super::IngestSource, convert = Box::new))]
    #[serde(rename = "source")]
    source: Box<super::IngestSource>,
    #[builder(custom(type = super::DatasetIngestTarget, convert = Box::new))]
    #[serde(rename = "target")]
    target: Box<super::DatasetIngestTarget>,
    #[builder(default, into)]
    #[serde(
        rename = "additionalFileTags",
        skip_serializing_if = "Option::is_none",
        default
    )]
    additional_file_tags: Option<std::collections::BTreeMap<String, String>>,
    #[builder(
        default,
        custom(
            type = impl
            Into<Option<super::AvroNumericTimestampType>>,
            convert = |v|v.into().map(Box::new)
        )
    )]
    #[serde(rename = "timestampType", skip_serializing_if = "Option::is_none", default)]
    timestamp_type: Option<Box<super::AvroNumericTimestampType>>,
}
impl AvroStreamOpts {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(source: super::IngestSource, target: super::DatasetIngestTarget) -> Self {
        Self::builder().source(source).target(target).build()
    }
    #[inline]
    pub fn source(&self) -> &super::IngestSource {
        &*self.source
    }
    #[inline]
    pub fn target(&self) -> &super::DatasetIngestTarget {
        &*self.target
    }
    /// Specifies a tag set to apply to all data in the file.
    #[inline]
    pub fn additional_file_tags(
        &self,
    ) -> Option<&std::collections::BTreeMap<String, String>> {
        self.additional_file_tags.as_ref().map(|o| &*o)
    }
    /// How to interpret the numeric values in the `timestamps` array. Defaults to epoch-nanoseconds
    /// when omitted, matching the original contract of this API.
    #[inline]
    pub fn timestamp_type(&self) -> Option<&super::AvroNumericTimestampType> {
        self.timestamp_type.as_ref().map(|o| &**o)
    }
}
