use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[cfg_attr(feature = "ts", derive(ts_rs::TS))]
#[serde(rename_all = "snake_case")]
pub enum ProductPermission {
Read { scope: String },
Write { scope: String },
}
impl ProductPermission {
pub fn read(scope: impl Into<String>) -> Self {
Self::Read {
scope: scope.into(),
}
}
pub fn write(scope: impl Into<String>) -> Self {
Self::Write {
scope: scope.into(),
}
}
pub fn is_write(&self) -> bool {
matches!(self, Self::Write { .. })
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[cfg_attr(feature = "ts", derive(ts_rs::TS))]
#[serde(rename_all = "snake_case")]
pub enum PlatformPermission {
Filesystem,
Shell,
Process,
Notifications,
CredentialStore,
GlobalShortcut,
Autostart,
}