pub const WASI_RUNNER_URI: &str = "https://webc.org/runner/wasi";
pub const WCGI_RUNNER_URI: &str = "https://webc.org/runner/wcgi";
pub const EMSCRIPTEN_RUNNER_URI: &str = "https://webc.org/runner/emscripten";
pub const WASM4_RUNNER_URI: &str = "https://webc.org/runner/wasm4";
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "kebab-case")]
#[non_exhaustive]
pub struct Wasi {
    #[deprecated(since = "5.5.0", note = "Use the explicit \"atom\" annotation instead")]
    pub atom: String,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub package: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub env: Option<Vec<String>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub main_args: Option<Vec<String>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub mount_atom_in_volume: Option<String>,
}
impl Wasi {
    pub const KEY: &str = "wasi";
    #[allow(deprecated)]
    pub fn new(atom: impl Into<String>) -> Self {
        Wasi {
            atom: atom.into(),
            package: None,
            env: None,
            main_args: None,
            mount_atom_in_volume: None,
        }
    }
    pub fn with_env(&mut self, key: impl AsRef<str>, value: impl AsRef<str>) -> &mut Self {
        let key = key.as_ref();
        let value = value.as_ref();
        self.env
            .get_or_insert_with(Vec::new)
            .push(format!("{key}={value}"));
        self
    }
}
#[derive(Default, Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "kebab-case")]
#[non_exhaustive]
pub struct Wcgi {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub dialect: Option<String>,
}
impl Wcgi {
    pub const KEY: &str = "wcgi";
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
#[non_exhaustive]
#[serde(rename_all = "kebab-case")]
pub struct Wapm {
    pub name: String,
    pub version: String,
    pub description: String,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub license: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub license_file: Option<VolumeSpecificPath>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub readme: Option<VolumeSpecificPath>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub repository: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub homepage: Option<String>,
    #[serde(default, skip_serializing_if = "std::ops::Not::not")]
    pub private: bool,
}
impl Wapm {
    pub const KEY: &str = "wapm";
    pub fn new(
        name: impl Into<String>,
        version: impl Into<String>,
        description: impl Into<String>,
    ) -> Self {
        Wapm {
            name: name.into(),
            version: version.into(),
            description: description.into(),
            license: None,
            license_file: None,
            readme: None,
            repository: None,
            homepage: None,
            private: false,
        }
    }
}
#[derive(
    Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, serde::Deserialize, serde::Serialize,
)]
pub struct VolumeSpecificPath {
    pub volume: String,
    pub path: String,
}
#[derive(Default, Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Emscripten {
    #[deprecated(since = "5.5.0", note = "Use the explicit \"atom\" annotation")]
    #[serde(default)]
    pub atom: Option<String>,
    #[serde(default)]
    pub package: Option<String>,
    #[serde(default)]
    pub env: Option<Vec<String>>,
    #[serde(default)]
    pub main_args: Option<Vec<String>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub mount_atom_in_volume: Option<String>,
}
impl Emscripten {
    pub const KEY: &str = "emscripten";
}
#[derive(Debug, Default, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct FileSystemMappings(pub Vec<FileSystemMapping>);
impl std::ops::Deref for FileSystemMappings {
    type Target = Vec<FileSystemMapping>;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl<T> PartialEq<T> for FileSystemMappings
where
    Vec<FileSystemMapping>: PartialEq<T>,
{
    fn eq(&self, other: &T) -> bool {
        self.0 == *other
    }
}
impl IntoIterator for FileSystemMappings {
    type Item = FileSystemMapping;
    type IntoIter = <Vec<FileSystemMapping> as IntoIterator>::IntoIter;
    fn into_iter(self) -> Self::IntoIter {
        self.0.into_iter()
    }
}
impl FileSystemMappings {
    pub const KEY: &str = "fs";
}
#[derive(Debug, Default, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct FileSystemMapping {
    pub from: Option<String>,
    pub volume_name: String,
    pub original_path: String,
    pub mount_path: String,
}
#[derive(Debug, Default, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "kebab-case")]
#[non_exhaustive]
pub struct Atom {
    pub name: String,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub dependency: Option<String>,
}
impl Atom {
    pub const KEY: &str = "atom";
    pub fn new(name: impl Into<String>, dependency: impl Into<Option<String>>) -> Self {
        Atom {
            name: name.into(),
            dependency: dependency.into(),
        }
    }
}