use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ComputerUseApprovalRequestKindResourceBrowserAuthentication {
#[serde(rename = "type")]
pub r#type: Type,
#[serde(rename = "reason", deserialize_with = "Option::deserialize")]
pub reason: Option<String>,
#[serde(rename = "credential_origin", deserialize_with = "Option::deserialize")]
pub credential_origin: Option<String>,
#[serde(rename = "fields")]
pub fields: Vec<models::BrowserAuthenticationFieldResource>,
#[serde(rename = "options")]
pub options: Vec<models::BrowserAuthenticationOptionResource>,
}
impl ComputerUseApprovalRequestKindResourceBrowserAuthentication {
pub fn new(
r#type: Type,
reason: Option<String>,
credential_origin: Option<String>,
fields: Vec<models::BrowserAuthenticationFieldResource>,
options: Vec<models::BrowserAuthenticationOptionResource>,
) -> ComputerUseApprovalRequestKindResourceBrowserAuthentication {
ComputerUseApprovalRequestKindResourceBrowserAuthentication {
r#type,
reason,
credential_origin,
fields,
options,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "browser_authentication")]
BrowserAuthentication,
}
impl Default for Type {
fn default() -> Type {
Self::BrowserAuthentication
}
}
impl std::fmt::Display for ComputerUseApprovalRequestKindResourceBrowserAuthentication {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match serde_json::to_string(self) {
Ok(s) => write!(f, "{}", s),
Err(_) => Err(std::fmt::Error),
}
}
}