use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum LoginState {
SignIn,
SignUp,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DialogType {
AccountChooser,
AutoReauthn,
ConfirmIdpLogin,
Error,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DialogButton {
ConfirmIdpLoginContinue,
ErrorGotIt,
ErrorMoreDetails,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AccountUrlType {
TermsOfService,
PrivacyPolicy,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Account {
#[serde(rename = "accountId")]
pub account_id: String,
pub email: String,
pub name: String,
#[serde(rename = "givenName")]
pub given_name: String,
#[serde(rename = "pictureUrl")]
pub picture_url: String,
#[serde(rename = "idpConfigUrl")]
pub idp_config_url: String,
#[serde(rename = "idpLoginUrl")]
pub idp_login_url: String,
#[serde(rename = "loginState")]
pub login_state: LoginState,
#[serde(
rename = "termsOfServiceUrl",
default,
skip_serializing_if = "Option::is_none"
)]
pub terms_of_service_url: Option<String>,
#[serde(
rename = "privacyPolicyUrl",
default,
skip_serializing_if = "Option::is_none"
)]
pub privacy_policy_url: Option<String>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct EnableParams {
#[serde(
rename = "disableRejectionDelay",
default,
skip_serializing_if = "Option::is_none"
)]
pub disable_rejection_delay: Option<bool>,
}
impl crate::typed::Command for EnableParams {
const METHOD: &'static str = "FedCm.enable";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DisableParams {}
impl crate::typed::Command for DisableParams {
const METHOD: &'static str = "FedCm.disable";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SelectAccountParams {
#[serde(rename = "dialogId")]
pub dialog_id: String,
#[serde(rename = "accountIndex")]
pub account_index: i64,
}
impl crate::typed::Command for SelectAccountParams {
const METHOD: &'static str = "FedCm.selectAccount";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ClickDialogButtonParams {
#[serde(rename = "dialogId")]
pub dialog_id: String,
#[serde(rename = "dialogButton")]
pub dialog_button: DialogButton,
}
impl crate::typed::Command for ClickDialogButtonParams {
const METHOD: &'static str = "FedCm.clickDialogButton";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct OpenUrlParams {
#[serde(rename = "dialogId")]
pub dialog_id: String,
#[serde(rename = "accountIndex")]
pub account_index: i64,
#[serde(rename = "accountUrlType")]
pub account_url_type: AccountUrlType,
}
impl crate::typed::Command for OpenUrlParams {
const METHOD: &'static str = "FedCm.openUrl";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DismissDialogParams {
#[serde(rename = "dialogId")]
pub dialog_id: String,
#[serde(
rename = "triggerCooldown",
default,
skip_serializing_if = "Option::is_none"
)]
pub trigger_cooldown: Option<bool>,
}
impl crate::typed::Command for DismissDialogParams {
const METHOD: &'static str = "FedCm.dismissDialog";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ResetCooldownParams {}
impl crate::typed::Command for ResetCooldownParams {
const METHOD: &'static str = "FedCm.resetCooldown";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DialogShownEvent {
#[serde(rename = "dialogId")]
pub dialog_id: String,
#[serde(rename = "dialogType")]
pub dialog_type: DialogType,
pub accounts: Vec<Account>,
pub title: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub subtitle: Option<String>,
}
impl crate::typed::Event for DialogShownEvent {
const METHOD: &'static str = "FedCm.dialogShown";
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DialogClosedEvent {
#[serde(rename = "dialogId")]
pub dialog_id: String,
}
impl crate::typed::Event for DialogClosedEvent {
const METHOD: &'static str = "FedCm.dialogClosed";
}