use super::{ContractId, Money};
use rust_decimal::Decimal;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
use time::OffsetDateTime;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)]
pub struct ScannerResult {
pub rank: u32,
pub contract_id: ContractId,
pub symbol: String,
pub description: Option<String>,
pub last: Option<Money>,
#[schemars(with = "Option<String>")]
pub change_percent: Option<Decimal>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)]
pub struct ScannerRun {
pub scanner_code: String,
#[serde(default)]
pub filters: BTreeMap<String, String>,
pub results: Vec<ScannerResult>,
#[serde(with = "time::serde::rfc3339")]
#[schemars(with = "String")]
pub snapshot_timestamp: OffsetDateTime,
}