1use serde::{Deserialize, Serialize};
2
3#[derive(Serialize, Deserialize, Debug, Clone)]
4pub struct TextSegment {
5 pub text: String,
6}
7
8#[derive(Serialize, Deserialize, Debug, Clone)]
9pub struct FaceSegment {
10 pub id: String,
11}
12
13#[derive(Serialize, Deserialize, Debug, Clone)]
14pub struct ImageSegment {
15 pub file: String,
16}
17
18#[derive(Serialize, Deserialize, Debug, Clone)]
19pub struct RecordSegment {
20 pub file: String,
21}
22
23#[derive(Serialize, Deserialize, Debug, Clone)]
24pub struct VideoSegment {
25 pub file: String,
26}
27
28#[derive(Serialize, Deserialize, Debug, Clone)]
29pub struct AtSegment {
30 pub qq: String,
31}
32
33#[derive(Serialize, Deserialize, Debug, Clone)]
34pub struct DiceSegment;
35
36#[derive(Serialize, Deserialize, Debug, Clone)]
37pub struct ShakeSegment;
38
39#[derive(Serialize, Deserialize, Debug, Clone)]
40pub struct PokeSegment {
41 #[serde(rename = "type")]
42 pub ty: String,
43 pub id: String,
44}
45
46#[derive(Serialize, Deserialize, Debug, Clone)]
47pub struct AnonymousSegment;
48
49#[derive(Serialize, Deserialize, Debug, Clone)]
50pub struct ShareSegment {
51 pub url: String,
52 pub title: String,
53}
54
55#[derive(Serialize, Deserialize, Debug, Clone)]
56pub enum ContactType {
57 QQ,
58 Group,
59}
60
61#[derive(Serialize, Deserialize, Debug, Clone)]
62pub struct ContactSegment {
63 #[serde(rename = "type")]
64 pub ty: ContactType,
65 pub id: String,
66}
67
68#[derive(Serialize, Deserialize, Debug, Clone)]
69pub struct LocationSegment {
70 pub lat: String,
71 pub lon: String,
72 pub title: Option<String>,
73 pub content: Option<String>,
74}
75
76#[derive(Serialize, Deserialize, Debug, Clone)]
77pub struct MusicSegment {
78 #[serde(rename = "type")]
79 pub ty: String,
80 pub id: Option<String>,
81 pub url: Option<String>,
82 pub audio: Option<String>,
83 pub title: Option<String>,
84}
85
86#[derive(Serialize, Deserialize, Debug, Clone)]
87pub struct ReplySegment {
88 pub id: String,
89}
90
91#[derive(Serialize, Deserialize, Debug, Clone)]
92pub struct ForwardSegment {
93 pub id: String,
94}
95
96#[derive(Serialize, Deserialize, Debug, Clone)]
97pub struct NodeSegment {
98 pub id: String,
99}
100
101#[derive(Serialize, Deserialize, Debug, Clone)]
102pub struct XmlSegment {
103 pub data: String,
104}
105
106#[derive(Serialize, Deserialize, Debug, Clone)]
107pub struct JsonSegment {
108 pub data: String,
109}
110
111#[derive(Serialize, Deserialize, Debug, Clone)]
112#[serde(tag = "type", content = "data", rename_all = "snake_case")]
113pub enum Segment {
114 Text(TextSegment),
115 Face(FaceSegment),
116 Image(ImageSegment),
117 Record(RecordSegment),
118 Video(VideoSegment),
119 At(AtSegment),
120 Dice(DiceSegment),
121 Shake(ShakeSegment),
122 Poke(PokeSegment),
123 Anonymous(AnonymousSegment),
124 Share(ShareSegment),
125 Contact(ContactSegment),
126 Location(LocationSegment),
127 Music(MusicSegment),
128 Reply(ReplySegment),
129 Forward(ForwardSegment),
130 Node(NodeSegment),
131 Xml(XmlSegment),
132 Json(JsonSegment),
133}