// This file is generated by atrium-codegen. DO NOT EDIT.
//!Definitions for the `com.atproto.server.createAccount` namespace.
pub const NSID: &str = "com.atproto.server.createAccount";
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct InputData {
    ///Pre-existing atproto DID, being imported to a new account.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub did: Option<crate::types::string::Did>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub email: Option<String>,
    ///Requested handle for the account.
    pub handle: crate::types::string::Handle,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invite_code: Option<String>,
    ///Initial account password. May need to meet instance-specific password strength requirements.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub password: Option<String>,
    ///A signed DID PLC operation to be submitted as part of importing an existing account to this instance. NOTE: this optional field may be updated when full account migration is implemented.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub plc_op: Option<crate::records::Record>,
    ///DID PLC rotation key (aka, recovery key) to be included in PLC creation operation.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub recovery_key: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub verification_code: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub verification_phone: Option<String>,
}
pub type Input = crate::types::Object<InputData>;
///Account login session returned on successful account creation.
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct OutputData {
    pub access_jwt: String,
    ///The DID of the new account.
    pub did: crate::types::string::Did,
    ///Complete DID document.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub did_doc: Option<crate::did_doc::DidDocument>,
    pub handle: crate::types::string::Handle,
    pub refresh_jwt: String,
}
pub type Output = crate::types::Object<OutputData>;
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "error", content = "message")]
pub enum Error {
    InvalidHandle(Option<String>),
    InvalidPassword(Option<String>),
    InvalidInviteCode(Option<String>),
    HandleNotAvailable(Option<String>),
    UnsupportedDomain(Option<String>),
    UnresolvableDid(Option<String>),
    IncompatibleDidDoc(Option<String>),
}
impl std::fmt::Display for Error {
    fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
        match self {
            Error::InvalidHandle(msg) => {
                write!(_f, "InvalidHandle")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
            Error::InvalidPassword(msg) => {
                write!(_f, "InvalidPassword")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
            Error::InvalidInviteCode(msg) => {
                write!(_f, "InvalidInviteCode")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
            Error::HandleNotAvailable(msg) => {
                write!(_f, "HandleNotAvailable")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
            Error::UnsupportedDomain(msg) => {
                write!(_f, "UnsupportedDomain")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
            Error::UnresolvableDid(msg) => {
                write!(_f, "UnresolvableDid")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
            Error::IncompatibleDidDoc(msg) => {
                write!(_f, "IncompatibleDidDoc")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
        }
        Ok(())
    }
}
