rpfm_lib/notes/mod.rs
1//---------------------------------------------------------------------------//
2// Copyright (c) 2017-2026 Ismael Gutiérrez González. All rights reserved.
3//
4// This file is part of the Rusted PackFile Manager (RPFM) project,
5// which can be found here: https://github.com/Frodo45127/rpfm.
6//
7// This file is licensed under the MIT license, which can be found here:
8// https://github.com/Frodo45127/rpfm/blob/master/LICENSE.
9//---------------------------------------------------------------------------//
10
11//! Module for managing user notes attached to PackFile entries.
12//!
13//! This module provides functionality for creating and managing notes that users can attach
14//! to specific files within a PackFile or as global notes for the entire PackFile.
15//!
16//! # Usage
17//!
18//! Notes can be:
19//! - **Path-specific**: Attached to a particular file path within the PackFile
20//! - **Global**: Applied to the entire PackFile (when `path` is empty)
21//!
22//! Each note has a unique ID, message body, and optional URL for external references.
23
24use getset::{Getters, Setters};
25use serde_derive::{Serialize, Deserialize};
26
27//---------------------------------------------------------------------------//
28// Enum & Structs
29//---------------------------------------------------------------------------//
30
31/// Represents a user note attached to a PackFile or a specific file within it.
32///
33/// Notes provide a way for users to annotate their work, leave reminders, or document
34/// specific files or aspects of their PackFile modifications.
35///
36/// # Examples
37///
38/// Creating a global note:
39/// ```ignore
40/// # use rpfm_lib::notes::Note;
41/// let note = Note {
42/// id: 1,
43/// message: "Remember to test this before release".to_string(),
44/// url: None,
45/// path: String::new(), // Empty path = global note
46/// };
47/// ```
48///
49/// Creating a path-specific note:
50/// ```ignore
51/// # use rpfm_lib::notes::Note;
52/// let note = Note {
53/// id: 2,
54/// message: "This table needs balancing".to_string(),
55/// url: Some("https://wiki.example.com/balance".to_string()),
56/// path: "db/units_tables/core_units".to_string(),
57/// };
58/// ```
59#[derive(Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Getters, Setters)]
60#[getset(get = "pub", set = "pub")]
61pub struct Note {
62
63 /// Unique identifier for this note.
64 ///
65 /// Used to distinguish between different notes and for referencing specific notes.
66 id: u64,
67
68 /// The main content/body of the note.
69 ///
70 /// Contains the user's message, reminder, or documentation text.
71 message: String,
72
73 /// Optional URL associated with the note.
74 ///
75 /// Can be used to link to external documentation, wiki pages, issue trackers, etc.
76 url: Option<String>,
77
78 /// Path within the PackFile where this note applies.
79 ///
80 /// - Empty string: Global note that applies to the entire PackFile
81 /// - Non-empty: Path to a specific file (e.g., `"db/units_tables/core_units"`)
82 path: String,
83}
84
85//---------------------------------------------------------------------------//
86// Enum & Structs Implementations
87//---------------------------------------------------------------------------//
88
89impl Note {}