use serde::{Deserialize, Serialize};
use std::ops::Deref;
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ResearchReports(pub Vec<ResearchReport>);
impl Deref for ResearchReports {
type Target = Vec<ResearchReport>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl IntoIterator for ResearchReports {
type Item = ResearchReport;
type IntoIter = std::vec::IntoIter<ResearchReport>;
fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}
impl<'a> IntoIterator for &'a ResearchReports {
type Item = &'a ResearchReport;
type IntoIter = std::slice::Iter<'a, ResearchReport>;
fn into_iter(self) -> Self::IntoIter {
self.0.iter()
}
}
#[cfg(feature = "dataframe")]
impl ResearchReports {
pub fn to_dataframe(&self) -> ::polars::prelude::PolarsResult<::polars::prelude::DataFrame> {
ResearchReport::vec_to_dataframe(&self.0)
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "dataframe", derive(crate::ToDataFrame))]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub struct ResearchReport {
#[serde(skip_serializing_if = "Option::is_none")]
pub report_headline: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub author: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub report_date: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub provider: Option<String>,
}