use mogh_resolver::Resolve;
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
use crate::entities::{I64, MongoDocument, U64, alert::Alert};
use super::KomodoReadRequest;
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/ListAlerts",
description = "Get a paginated list of alerts sorted by timestamp descending.",
request_body(content = ListAlerts),
responses(
(status = 200, description = "The paginated list of alerts", body = ListAlertsResponse),
),
)]
pub fn list_alerts() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Default, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoReadRequest)]
#[response(ListAlertsResponse)]
#[error(mogh_error::Error)]
pub struct ListAlerts {
#[cfg_attr(feature = "utoipa", schema(value_type = serde_json::Value))]
pub query: Option<MongoDocument>,
#[serde(default)]
pub page: U64,
}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct ListAlertsResponse {
pub alerts: Vec<Alert>,
pub next_page: Option<I64>,
}
#[cfg(feature = "utoipa")]
#[utoipa::path(
post,
path = "/GetAlert",
description = "Get an alert.",
request_body(content = GetAlert),
responses(
(status = 200, description = "The alert", body = GetAlertResponse),
),
)]
pub fn get_alert() {}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolve)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[empty_traits(KomodoReadRequest)]
#[response(GetAlertResponse)]
#[error(mogh_error::Error)]
pub struct GetAlert {
pub id: String,
}
#[typeshare]
pub type GetAlertResponse = Alert;