#[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 InitiateMultipartUploadRequest {
    #[builder(into)]
    #[serde(rename = "filename")]
    filename: String,
    #[builder(into)]
    #[serde(rename = "filetype")]
    filetype: String,
    #[builder(default, into)]
    #[serde(rename = "workspace", skip_serializing_if = "Option::is_none", default)]
    workspace: Option<conjure_object::ResourceIdentifier>,
    #[builder(default, into)]
    #[serde(rename = "resource", skip_serializing_if = "Option::is_none", default)]
    resource: Option<conjure_object::ResourceIdentifier>,
    #[builder(default, into)]
    #[serde(rename = "destination", skip_serializing_if = "Option::is_none", default)]
    destination: Option<super::UploadDestination>,
}
impl InitiateMultipartUploadRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(filename: impl Into<String>, filetype: impl Into<String>) -> Self {
        Self::builder().filename(filename).filetype(filetype).build()
    }
    /// The desired name of the file in object storage. The final name will be
    /// prefixed with a timestamp to ensure uniqueness.
    #[inline]
    pub fn filename(&self) -> &str {
        &*self.filename
    }
    /// The MIME type of the file, eg "text/csv" for CSVs or "application/octet-stream"
    /// for binary files.
    #[inline]
    pub fn filetype(&self) -> &str {
        &*self.filetype
    }
    /// The workspace in which to upload the file. If not provided, the file will be uploaded to
    /// the default workspace for the user's organization, if that is configured and the user
    /// has access to it. Ignored if `resource` is provided.
    #[inline]
    pub fn workspace(&self) -> Option<&conjure_object::ResourceIdentifier> {
        self.workspace.as_ref().map(|o| &*o)
    }
    /// The RID of an existing resource (e.g. a dataset) that this upload is intended to feed.
    /// When provided, the server resolves the destination workspace from the resource and
    /// authorizes the caller via the resource's permissions rather than via the workspace
    /// default-fallback. Use this in flows where the caller already knows the target resource
    /// (e.g. mesh file ingest into an existing remote dataset); this avoids the
    /// `Security:WorkspaceNotSpecified` failure for API keys whose user has no default
    /// workspace. If both `resource` and `workspace` are set, `resource` takes precedence.
    #[inline]
    pub fn resource(&self) -> Option<&conjure_object::ResourceIdentifier> {
        self.resource.as_ref().map(|o| &*o)
    }
    /// The object-storage bucket the upload should be written to. Defaults to UPLOADS.
    /// Use FILE_STORE to write managed File Store bytes; the returned `bucket` must be
    /// passed back on the signPart/completeMultipartUpload/abortMultipartUpload calls.
    #[inline]
    pub fn destination(&self) -> Option<&super::UploadDestination> {
        self.destination.as_ref().map(|o| &*o)
    }
}
