/*
 * 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 Session {
	/// String representing the object's type. Objects of the same type share the same value.
	#[serde(rename = "object")]
	pub object: Object,
	#[serde(rename = "id")]
	pub id: String,
	#[serde(rename = "user_id")]
	pub user_id: String,
	#[serde(rename = "client_id")]
	pub client_id: String,
	#[serde(
		rename = "actor",
		default,
		with = "::serde_with::rust::double_option",
		skip_serializing_if = "Option::is_none"
	)]
	pub actor: Option<Option<serde_json::Value>>,
	#[serde(rename = "status")]
	pub status: Status,
	#[serde(
		rename = "last_active_organization_id",
		default,
		with = "::serde_with::rust::double_option",
		skip_serializing_if = "Option::is_none"
	)]
	pub last_active_organization_id: Option<Option<String>>,
	#[serde(rename = "last_active_at")]
	pub last_active_at: i32,
	#[serde(rename = "expire_at")]
	pub expire_at: i32,
	#[serde(rename = "abandon_at")]
	pub abandon_at: i32,
	/// Unix timestamp of last update.
	#[serde(rename = "updated_at")]
	pub updated_at: i64,
	/// Unix timestamp of creation.
	#[serde(rename = "created_at")]
	pub created_at: i64,
}

impl Session {
	pub fn new(
		object: Object,
		id: String,
		user_id: String,
		client_id: String,
		status: Status,
		last_active_at: i32,
		expire_at: i32,
		abandon_at: i32,
		updated_at: i64,
		created_at: i64,
	) -> Session {
		Session {
			object,
			id,
			user_id,
			client_id,
			actor: None,
			status,
			last_active_organization_id: None,
			last_active_at,
			expire_at,
			abandon_at,
			updated_at,
			created_at,
		}
	}
}

/// 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 = "session")]
	Session,
}

impl Default for Object {
	fn default() -> Object {
		Self::Session
	}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
	#[serde(rename = "active")]
	Active,
	#[serde(rename = "revoked")]
	Revoked,
	#[serde(rename = "ended")]
	Ended,
	#[serde(rename = "expired")]
	Expired,
	#[serde(rename = "removed")]
	Removed,
	#[serde(rename = "abandoned")]
	Abandoned,
}

impl Default for Status {
	fn default() -> Status {
		Self::Active
	}
}
