use serde::{Deserialize, Serialize};
use serde_json::Value;
#[derive(Serialize, Deserialize, Debug)]
pub struct Message {
pub token: Option<String>,
pub notification: Option<Notification>,
pub data: Option<serde_json::Value>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct Notification {
pub title: Option<String>,
pub body: Option<String>,
}
#[derive(Serialize, Debug)]
pub struct FcmSendRequest {
pub message: Message,
}
#[derive(Deserialize)]
#[serde(untagged)]
pub enum FcmSendResult {
Success(FcmSuccessResponse),
Error(FcmErrorResponse),
}
#[derive(Deserialize, Debug)]
pub struct FcmSuccessResponse {
pub name: String,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct FcmErrorResponse {
pub error: ErrorResponse,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct ErrorResponse {
pub code: usize,
pub message: String,
pub status: String,
pub details: Vec<Value>,
}