use serde::Deserialize;
use std::{collections::HashMap, fmt::Display};
#[derive(Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord)]
pub enum CodeQLPackType {
Library,
#[default]
Queries,
Models,
Testing,
}
impl Display for CodeQLPackType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
CodeQLPackType::Library => write!(f, "Library"),
CodeQLPackType::Queries => write!(f, "Queries"),
CodeQLPackType::Models => write!(f, "Models"),
CodeQLPackType::Testing => write!(f, "Testing"),
}
}
}
#[derive(Debug, Clone, Default, Deserialize)]
pub struct PackYaml {
pub name: String,
pub library: Option<bool>,
pub version: Option<String>,
pub groups: Option<Vec<String>>,
pub dependencies: Option<HashMap<String, String>>,
pub suites: Option<String>,
#[serde(rename = "defaultSuiteFile")]
pub default_suite_file: Option<String>,
pub extractor: Option<String>,
#[serde(rename = "extensionTargets")]
pub extension_targets: Option<HashMap<String, String>>,
#[serde(rename = "dataExtensions")]
pub data_extensions: Option<Vec<String>>,
pub tests: Option<String>,
}
#[derive(Debug, Clone, Default, Deserialize)]
pub struct PackYamlLock {
#[serde(rename = "lockVersion")]
pub lock_version: String,
pub dependencies: HashMap<String, PackYamlLockDependency>,
pub compiled: bool,
}
#[derive(Debug, Clone, Default, Deserialize)]
pub struct PackYamlLockDependency {
pub version: String,
}