use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
pub struct HistoryItem {
pub id: String,
pub session_id: String,
pub query: String,
#[schema(value_type = String)]
pub executed_at: DateTime<Utc>,
pub execution_time_ms: i64,
pub rows_returned: i64,
pub success: bool,
pub error_message: Option<String>,
}
#[derive(Debug, Deserialize, utoipa::ToSchema)]
pub struct AddHistoryRequest {
pub query: String,
pub execution_time_ms: i64,
pub rows_returned: i64,
pub success: bool,
pub error_message: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
pub struct FavoriteItem {
pub id: String,
pub session_id: String,
pub name: String,
pub query: String,
pub description: Option<String>,
#[schema(value_type = String)]
pub created_at: DateTime<Utc>,
}
#[derive(Debug, Deserialize, utoipa::ToSchema)]
pub struct AddFavoriteRequest {
pub name: String,
pub query: String,
pub description: Option<String>,
}
#[derive(Debug, Deserialize, utoipa::ToSchema)]
pub struct UpdateFavoriteRequest {
pub name: Option<String>,
pub query: Option<String>,
pub description: Option<String>,
}
#[derive(Debug, Serialize, utoipa::ToSchema)]
pub struct FavoriteListResponse {
pub items: Vec<FavoriteItem>,
}
#[derive(Debug, Serialize, utoipa::ToSchema)]
pub struct HistoryListResponse {
pub items: Vec<HistoryItem>,
pub total: i64,
}