/*
 * 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 Template {
	#[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", skip_serializing_if = "Option::is_none")]
	pub object: Option<Object>,
	/// the id of the instance the template belongs to
	#[serde(
		rename = "instance_id",
		default,
		with = "::serde_with::rust::double_option",
		skip_serializing_if = "Option::is_none"
	)]
	pub instance_id: Option<Option<String>>,
	/// whether this is a system (default) or user overridden) template
	#[serde(rename = "resource_type", skip_serializing_if = "Option::is_none")]
	pub resource_type: Option<String>,
	/// whether this is an email or SMS template
	#[serde(rename = "template_type", skip_serializing_if = "Option::is_none")]
	pub template_type: Option<String>,
	/// user-friendly name of the template
	#[serde(rename = "name", skip_serializing_if = "Option::is_none")]
	pub name: Option<String>,
	/// machine-friendly name of the template
	#[serde(rename = "slug", skip_serializing_if = "Option::is_none")]
	pub slug: Option<String>,
	/// position with the listing of templates
	#[serde(rename = "position", skip_serializing_if = "Option::is_none")]
	pub position: Option<i32>,
	/// whether this template can be reverted to the corresponding system default
	#[serde(rename = "can_revert", skip_serializing_if = "Option::is_none")]
	pub can_revert: Option<bool>,
	/// whether this template can be deleted
	#[serde(rename = "can_delete", skip_serializing_if = "Option::is_none")]
	pub can_delete: Option<bool>,
	/// email subject
	#[serde(
		rename = "subject",
		default,
		with = "::serde_with::rust::double_option",
		skip_serializing_if = "Option::is_none"
	)]
	pub subject: Option<Option<String>>,
	/// the editor markup used to generate the body of the template
	#[serde(rename = "markup", skip_serializing_if = "Option::is_none")]
	pub markup: Option<String>,
	/// the template body before variable interpolation
	#[serde(rename = "body", skip_serializing_if = "Option::is_none")]
	pub body: Option<String>,
	/// list of variables that are available for use in the template body
	#[serde(rename = "available_variables", skip_serializing_if = "Option::is_none")]
	pub available_variables: Option<Vec<String>>,
	/// list of variables that must be contained in the template body
	#[serde(rename = "required_variables", skip_serializing_if = "Option::is_none")]
	pub required_variables: Option<Vec<String>>,
	#[serde(rename = "from_email_name", skip_serializing_if = "Option::is_none")]
	pub from_email_name: Option<String>,
	#[serde(rename = "delivered_by_clerk", skip_serializing_if = "Option::is_none")]
	pub delivered_by_clerk: Option<bool>,
	/// Unix timestamp of last update.
	#[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")]
	pub updated_at: Option<i64>,
	/// Unix timestamp of creation.
	#[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
	pub created_at: Option<i64>,
}

impl Template {
	pub fn new() -> Template {
		Template {
			id: None,
			object: None,
			instance_id: None,
			resource_type: None,
			template_type: None,
			name: None,
			slug: None,
			position: None,
			can_revert: None,
			can_delete: None,
			subject: None,
			markup: None,
			body: None,
			available_variables: None,
			required_variables: None,
			from_email_name: None,
			delivered_by_clerk: None,
			updated_at: None,
			created_at: None,
		}
	}
}

/// 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 = "template")]
	Template,
}

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