cardinal_kernel/pack/metadata.rs
1use serde::{Deserialize, Serialize};
2
3/// Metadata for a card pack, stored in pack.toml
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct PackMeta {
6 /// Unique identifier for this pack (e.g., "core-set", "expansion-1")
7 pub pack_id: String,
8
9 /// Semantic version of this pack (e.g., "1.0.0")
10 pub version: String,
11
12 /// Optional list of pack dependencies (pack_id strings)
13 #[serde(default)]
14 pub dependencies: Vec<String>,
15
16 /// Optional human-readable name
17 #[serde(default)]
18 pub name: Option<String>,
19
20 /// Optional description
21 #[serde(default)]
22 pub description: Option<String>,
23}
24
25/// A single file entry in the manifest
26#[derive(Debug, Clone, Serialize, Deserialize)]
27pub struct FileEntry {
28 /// Relative path inside the pack (normalized with forward slashes)
29 pub path: String,
30
31 /// File size in bytes
32 pub size: u64,
33
34 /// SHA-256 hash of the file content (hex string)
35 pub sha256: String,
36}
37
38/// The manifest.toml file generated and included in each pack
39/// Lists all files with their metadata for verification
40#[derive(Debug, Clone, Serialize, Deserialize)]
41pub struct Manifest {
42 /// Pack metadata (copy of pack.toml for convenience)
43 pub pack: PackMeta,
44
45 /// List of all files in the pack
46 pub files: Vec<FileEntry>,
47}