// This file is generated by atrium-codegen. DO NOT EDIT.
//!Definitions for the `com.atproto.repo.applyWrites` namespace.
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Input {
    ///The handle or DID of the repo.
    pub repo: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub swap_commit: Option<String>,
    ///Validate the records?
    #[serde(skip_serializing_if = "Option::is_none")]
    pub validate: Option<bool>,
    pub writes: Vec<InputWritesItem>,
}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "error", content = "message")]
pub enum Error {
    InvalidSwap(Option<String>),
}
///Create a new record.
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Create {
    pub collection: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub rkey: Option<String>,
    pub value: crate::records::Record,
}
///Delete an existing record.
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Delete {
    pub collection: String,
    pub rkey: String,
}
///Update an existing record.
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Update {
    pub collection: String,
    pub rkey: String,
    pub value: crate::records::Record,
}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "$type")]
pub enum InputWritesItem {
    #[serde(rename = "com.atproto.repo.applyWrites#create")]
    Create(Box<Create>),
    #[serde(rename = "com.atproto.repo.applyWrites#update")]
    Update(Box<Update>),
    #[serde(rename = "com.atproto.repo.applyWrites#delete")]
    Delete(Box<Delete>),
}
