agent_first_mail/cli/archive.rs
1use clap::{Args, Subcommand};
2
3#[derive(Subcommand, Debug)]
4pub enum ArchiveAction {
5 /// List compact archived cases and/or direct-message archive categories.
6 List {
7 #[command(subcommand)]
8 target: Option<ArchiveListAction>,
9 },
10 /// Operate on a direct-message archive category.
11 Message {
12 #[command(subcommand)]
13 action: ArchiveMessageCommand,
14 },
15 /// Operate on an archived case.
16 Case {
17 #[command(subcommand)]
18 action: ArchiveCaseAction,
19 },
20}
21
22#[derive(Subcommand, Debug)]
23pub enum ArchiveListAction {
24 /// List compact archived cases.
25 Cases,
26 /// List compact direct-message archive categories.
27 Messages,
28}
29
30#[derive(Subcommand, Debug)]
31pub enum ArchiveMessageCommand {
32 /// Create a direct-message archive category and optionally file one message.
33 Create(ArchiveMessageCreateArgs),
34 /// Show archive category index and entries.
35 Show {
36 /// Direct-message archive category ref: aYYYYMMDDNNN or aYYYYMMDDNNN-any-suffix.
37 archive_ref: String,
38 },
39 /// Restore a direct archived message to triage.
40 Restore {
41 /// Direct-message archive category ref: aYYYYMMDDNNN or aYYYYMMDDNNN-any-suffix.
42 archive_ref: String,
43 message_id: String,
44 /// Why this message needs active triage again; required by default.
45 #[arg(long)]
46 reason: Option<String>,
47 },
48 /// Move a direct archived message to another archive category.
49 Move {
50 /// Source direct-message archive category ref.
51 archive_ref: String,
52 message_id: String,
53 /// Destination archive category ref.
54 new_archive_ref: String,
55 /// Why this category is better; required by default.
56 #[arg(long)]
57 reason: Option<String>,
58 },
59 /// Rename this archive category's human-readable name without changing its UID.
60 Rename {
61 /// Direct-message archive category ref: aYYYYMMDDNNN or aYYYYMMDDNNN-any-suffix.
62 archive_ref: String,
63 /// New human-readable archive name.
64 #[arg(long)]
65 name: String,
66 /// Why this name better represents the category; required by default.
67 #[arg(long)]
68 reason: Option<String>,
69 },
70 /// Set or replace one direct archive entry summary.
71 SetSummary {
72 /// Direct-message archive category ref: aYYYYMMDDNNN or aYYYYMMDDNNN-any-suffix.
73 archive_ref: String,
74 message_id: String,
75 #[arg(long)]
76 summary: String,
77 /// Why this summary is useful; required by default.
78 #[arg(long)]
79 reason: Option<String>,
80 },
81 /// Show or edit archive category notes.
82 Notes {
83 #[command(subcommand)]
84 action: ArchiveMessageNotesAction,
85 },
86}
87
88#[derive(Args, Debug, Clone)]
89pub struct ArchiveMessageCreateArgs {
90 /// Human-readable archive category name used in metadata and the directory suffix.
91 #[arg(long)]
92 pub name: String,
93 /// Optional message to immediately file into the new archive category.
94 #[arg(long)]
95 pub message: Option<String>,
96 /// Required when --message is supplied.
97 #[arg(long)]
98 pub summary: Option<String>,
99 /// Why this archive category is being created.
100 #[arg(long)]
101 pub reason: Option<String>,
102}
103
104#[derive(Subcommand, Debug)]
105pub enum ArchiveCaseAction {
106 /// Show the archived case.
107 Show {
108 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
109 case_ref: String,
110 },
111 /// Restore an archived case to an active case group.
112 Restore {
113 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
114 case_ref: String,
115 /// Active case group to restore into.
116 #[arg(long)]
117 group: String,
118 /// Why this case needs active attention again; required by default.
119 #[arg(long)]
120 reason: Option<String>,
121 },
122 /// Rename this archived case's human-readable name without changing its UID.
123 Rename {
124 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
125 case_ref: String,
126 /// New human-readable case name.
127 #[arg(long)]
128 name: String,
129 /// Why this name better represents the case; required by default.
130 #[arg(long)]
131 reason: Option<String>,
132 },
133 /// Show or edit archived case notes.
134 Notes {
135 #[command(subcommand)]
136 action: ArchiveCaseNotesAction,
137 },
138}
139
140#[derive(Subcommand, Debug)]
141pub enum ArchiveMessageNotesAction {
142 /// Show notes markdown.
143 Show {
144 /// Direct-message archive category ref: aYYYYMMDDNNN or aYYYYMMDDNNN-any-suffix.
145 archive_ref: String,
146 },
147 /// Append text to notes markdown.
148 Append {
149 /// Direct-message archive category ref: aYYYYMMDDNNN or aYYYYMMDDNNN-any-suffix.
150 archive_ref: String,
151 /// Markdown text to append.
152 #[arg(long)]
153 text: String,
154 },
155 /// Replace notes markdown with text.
156 Replace {
157 /// Direct-message archive category ref: aYYYYMMDDNNN or aYYYYMMDDNNN-any-suffix.
158 archive_ref: String,
159 /// Markdown text to write.
160 #[arg(long)]
161 text: String,
162 },
163}
164
165#[derive(Subcommand, Debug)]
166pub enum ArchiveCaseNotesAction {
167 /// Show notes markdown.
168 Show {
169 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
170 case_ref: String,
171 },
172 /// Append text to notes markdown.
173 Append {
174 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
175 case_ref: String,
176 /// Markdown text to append.
177 #[arg(long)]
178 text: String,
179 },
180 /// Replace notes markdown with text.
181 Replace {
182 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
183 case_ref: String,
184 /// Markdown text to write.
185 #[arg(long)]
186 text: String,
187 },
188}