use serde::Serialize;

#[derive(Serialize, Default)]
pub struct GlobalDispatchData {
    pub retcode: i32,
    #[serde(default, skip_serializing_if = "String::is_empty")]
    pub force_update_url: String,
    #[serde(default, skip_serializing_if = "String::is_empty")]
    pub msg: String,
    pub region_list: Vec<ServerListInfo>,
}

#[derive(Serialize, Default)]
pub struct ServerListInfo {
    pub name: String,
    pub dispatch_url: String,
    pub retcode: i32,
    pub title: String,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub stop_begin_time: Option<i64>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub stop_end_time: Option<i64>,
    #[serde(default, skip_serializing_if = "String::is_empty")]
    pub msg: String,
    pub env: u32,
    pub biz: String,
    pub area: i32,
    pub psn_region: i32,
    pub is_recommend: bool,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub ip: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub port: Option<i32>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "noticeRegion")]
    pub notice_region: Option<String>,
}
