/*
 * 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 Email {
	#[serde(rename = "object")]
	pub object: Object,
	#[serde(rename = "id")]
	pub id: String,
	#[serde(
		rename = "slug",
		default,
		with = "::serde_with::rust::double_option",
		skip_serializing_if = "Option::is_none"
	)]
	pub slug: Option<Option<String>>,
	#[serde(rename = "from_email_name")]
	pub from_email_name: String,
	#[serde(rename = "email_address_id", deserialize_with = "Option::deserialize")]
	pub email_address_id: Option<String>,
	#[serde(rename = "to_email_address")]
	pub to_email_address: String,
	#[serde(
		rename = "user_id",
		default,
		with = "::serde_with::rust::double_option",
		skip_serializing_if = "Option::is_none"
	)]
	pub user_id: Option<Option<String>>,
	#[serde(rename = "subject")]
	pub subject: String,
	#[serde(rename = "body")]
	pub body: String,
	#[serde(
		rename = "body_plain",
		default,
		with = "::serde_with::rust::double_option",
		skip_serializing_if = "Option::is_none"
	)]
	pub body_plain: Option<Option<String>>,
	#[serde(rename = "status")]
	pub status: String,
	#[serde(
		rename = "data",
		default,
		with = "::serde_with::rust::double_option",
		skip_serializing_if = "Option::is_none"
	)]
	pub data: Option<Option<serde_json::Value>>,
	#[serde(rename = "delivered_by_clerk")]
	pub delivered_by_clerk: bool,
}

impl Email {
	pub fn new(
		object: Object,
		id: String,
		from_email_name: String,
		email_address_id: Option<String>,
		to_email_address: String,
		subject: String,
		body: String,
		status: String,
		delivered_by_clerk: bool,
	) -> Email {
		Email {
			object,
			id,
			slug: None,
			from_email_name,
			email_address_id,
			to_email_address,
			user_id: None,
			subject,
			body,
			body_plain: None,
			status,
			data: None,
			delivered_by_clerk,
		}
	}
}

///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Object {
	#[serde(rename = "email")]
	Email,
}

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