1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
use serde_repr::{Deserialize_repr, Serialize_repr};

use crate::schemas::payload::PayloadType;

#[derive(Debug, Clone, PartialEq, FromPrimitive, Deserialize_repr, Serialize_repr)]
#[repr(i32)]
pub enum ScanStatus {
    Unknown,
    Cancel,
    Waiting,
    Scanned,
    Confirmed,
    Timeout,
}

#[derive(Debug, Clone)]
pub struct EventFriendshipPayload {
    pub friendship_id: String,
}

#[derive(Debug, Clone)]
pub struct EventLoginPayload {
    pub contact_id: String,
}

#[derive(Debug, Clone)]
pub struct EventLogoutPayload {
    pub contact_id: String,
    pub data: String,
}

#[derive(Debug, Clone)]
pub struct EventMessagePayload {
    pub message_id: String,
}

#[derive(Debug, Clone)]
pub struct EventRoomInvitePayload {
    pub room_invitation_id: String,
}

#[derive(Debug, Clone)]
pub struct EventRoomJoinPayload {
    pub invitee_id_list: Vec<String>,
    pub inviter_id: String,
    pub room_id: String,
    pub timestamp: u64,
}

#[derive(Debug, Clone)]
pub struct EventRoomLeavePayload {
    pub removee_id_list: Vec<String>,
    pub remover_id: String,
    pub room_id: String,
    pub timestamp: u64,
}

#[derive(Debug, Clone)]
pub struct EventRoomTopicPayload {
    pub changer_id: String,
    pub new_topic: String,
    pub old_topic: String,
    pub room_id: String,
    pub timestamp: u64,
}

#[derive(Debug, Clone)]
pub struct EventScanPayload {
    pub status: ScanStatus,
    pub qrcode: Option<String>,
    pub data: Option<String>,
}

#[derive(Debug, Clone)]
pub struct EventDongPayload {
    pub data: String,
}

#[derive(Debug, Clone)]
pub struct EventErrorPayload {
    pub data: String,
}

#[derive(Debug, Clone)]
pub struct EventReadyPayload {
    pub data: String,
}

#[derive(Debug, Clone)]
pub struct EventResetPayload {
    pub data: String,
}

#[derive(Debug, Clone)]
pub struct EventHeartbeatPayload {
    pub data: String,
}

#[derive(Debug, Clone)]
pub struct EventDirtyPayload {
    pub payload_type: PayloadType,
    pub payload_id: String,
}