futu_mcp/tool_enums/
price_reminder_op_enum.rs1use serde::Serialize;
4
5use super::ToolEnum;
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, schemars::JsonSchema)]
8#[serde(into = "i32")]
9#[non_exhaustive]
10pub enum PriceReminderOpEnum {
11 Add,
12 Del,
13 Enable,
14 Disable,
15 Modify,
16 DelAll,
17}
18
19impl From<PriceReminderOpEnum> for i32 {
20 fn from(p: PriceReminderOpEnum) -> Self {
21 p.as_i32()
22 }
23}
24
25impl ToolEnum for PriceReminderOpEnum {
26 fn type_name() -> &'static str {
27 "price_reminder_op"
28 }
29
30 fn from_i32(v: i32) -> Option<Self> {
31 Some(match v {
32 1 => Self::Add,
33 2 => Self::Del,
34 3 => Self::Enable,
35 4 => Self::Disable,
36 5 => Self::Modify,
37 6 => Self::DelAll,
38 _ => return None,
39 })
40 }
41
42 fn from_str(s: &str) -> Option<Self> {
43 Some(match s.trim().to_ascii_uppercase().as_str() {
44 "ADD" | "SETADD" | "SET_ADD" => Self::Add,
45 "DEL" | "DELETE" | "SETDEL" | "SET_DEL" => Self::Del,
46 "ENABLE" | "SETENABLE" | "SET_ENABLE" => Self::Enable,
47 "DISABLE" | "SETDISABLE" | "SET_DISABLE" => Self::Disable,
48 "MODIFY" | "SETMODIFY" | "SET_MODIFY" => Self::Modify,
49 "DELALL" | "DEL_ALL" | "SETDELALL" | "SET_DEL_ALL" => Self::DelAll,
50 _ => return None,
51 })
52 }
53
54 fn as_i32(self) -> i32 {
55 match self {
56 Self::Add => 1,
57 Self::Del => 2,
58 Self::Enable => 3,
59 Self::Disable => 4,
60 Self::Modify => 5,
61 Self::DelAll => 6,
62 }
63 }
64
65 fn all_int_values() -> Vec<i32> {
66 vec![1, 2, 3, 4, 5, 6]
67 }
68
69 fn all_string_values() -> Vec<&'static str> {
70 vec!["Add", "Del", "Enable", "Disable", "Modify", "DelAll"]
71 }
72}