use serde::{Serialize, Deserialize};
use super::WebhookEnvironmentValues;
/**Contains the state of a completed Link session, along with the public token(s) if available.
By default, the `EVENTS` webhook is sent only for sessions where the end user goes through a Hosted Link flow (including Link Recovery flows) or a Multi-Item Link flow. If you would like to receive this webhook for other sessions, contact your Account Manager or Support.*/
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LinkSessionFinishedWebhook {
///The Plaid environment the webhook was sent from
pub environment: WebhookEnvironmentValues,
///The identifier for the Link session.
pub link_session_id: String,
///The link token used to create the Link session.
pub link_token: String,
///The public token generated by the Link session. This field has been deprecated; please use `public_tokens` instead.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub public_token: Option<String>,
///The public tokens generated by the Link session.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub public_tokens: Option<Vec<String>>,
///The final status of the Link session. Will always be "SUCCESS" or "EXITED".
pub status: String,
///`SESSION_FINISHED`
pub webhook_code: String,
///`LINK`
pub webhook_type: String,
}
impl std::fmt::Display for LinkSessionFinishedWebhook {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
write!(f, "{}", serde_json::to_string(self).unwrap())
}
}