use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Command {
pub id: Option<i64>,
pub command: String,
pub timestamp: DateTime<Utc>,
pub directory: String,
#[serde(skip_serializing_if = "Vec::is_empty", default)]
pub tags: Vec<String>,
#[serde(skip_serializing_if = "Vec::is_empty", default)]
pub parameters: Vec<Parameter>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Parameter {
pub name: String,
pub description: Option<String>,
}
impl Parameter {
pub fn new(name: String) -> Self {
Self {
name,
description: None,
}
}
pub fn with_description(name: String, description: Option<String>) -> Self {
Self {
name,
description,
}
}
}