/*
 * Clerk Backend API
 *
 * The Clerk REST Backend API, meant to be accessed by backend servers. Please see https://clerk.com/docs for more information.
 *
 * The version of the OpenAPI document: v1
 * Contact: support@clerk.com
 * Generated by: https://openapi-generator.tech
 */

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct EmailAddress {
	#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
	pub id: Option<String>,
	/// String representing the object's type. Objects of the same type share the same value.
	#[serde(rename = "object")]
	pub object: Object,
	#[serde(rename = "email_address")]
	pub email_address: String,
	#[serde(rename = "reserved")]
	pub reserved: bool,
	#[serde(rename = "verification", deserialize_with = "Option::deserialize")]
	pub verification: Option<Box<crate::models::EmailAddressVerification>>,
	#[serde(rename = "linked_to")]
	pub linked_to: Vec<crate::models::IdentificationLink>,
}

impl EmailAddress {
	pub fn new(
		object: Object,
		email_address: String,
		reserved: bool,
		verification: Option<crate::models::EmailAddressVerification>,
		linked_to: Vec<crate::models::IdentificationLink>,
	) -> EmailAddress {
		EmailAddress {
			id: None,
			object,
			email_address,
			reserved,
			verification: if let Some(x) = verification { Some(Box::new(x)) } else { None },
			linked_to,
		}
	}
}

/// String representing the object's type. Objects of the same type share the same value.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Object {
	#[serde(rename = "email_address")]
	EmailAddress,
}

impl Default for Object {
	fn default() -> Object {
		Self::EmailAddress
	}
}
