1use serde::{Deserialize, Serialize};
4
5#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
9pub struct ActionKey {
10 pub app: String,
11 pub kind: String,
12 pub action: String,
13}
14
15pub const CREATE_ACTION: &str = "$create";
19
20impl ActionKey {
21 pub fn new(app: impl Into<String>, kind: impl Into<String>, action: impl Into<String>) -> Self {
22 Self {
23 app: app.into(),
24 kind: kind.into(),
25 action: action.into(),
26 }
27 }
28}
29
30impl std::fmt::Display for ActionKey {
31 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
32 write!(f, "{}/{}/{}", self.app, self.kind, self.action)
33 }
34}
35
36pub use tilo_action_policy::ActionKind;