use crate::errors::*;
use crate::types::*;
use uuid::Uuid;
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ThemeParameters {
#[doc(hidden)]
#[serde(rename(serialize = "@type", deserialize = "@type"))]
td_name: String,
#[doc(hidden)]
#[serde(rename(serialize = "@extra", deserialize = "@extra"))]
extra: Option<String>,
background_color: i64,
secondary_background_color: i64,
header_background_color: i64,
bottom_bar_background_color: i64,
section_background_color: i64,
section_separator_color: i64,
text_color: i64,
accent_text_color: i64,
section_header_text_color: i64,
subtitle_text_color: i64,
destructive_text_color: i64,
hint_color: i64,
link_color: i64,
button_color: i64,
button_text_color: i64,
}
impl RObject for ThemeParameters {
#[doc(hidden)]
fn td_name(&self) -> &'static str {
"themeParameters"
}
#[doc(hidden)]
fn extra(&self) -> Option<String> {
self.extra.clone()
}
fn to_json(&self) -> RTDResult<String> {
Ok(serde_json::to_string(self)?)
}
}
impl ThemeParameters {
pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
Ok(serde_json::from_str(json.as_ref())?)
}
pub fn builder() -> RTDThemeParametersBuilder {
let inner = ThemeParameters {
td_name: "themeParameters".to_string(),
extra: Some(Uuid::new_v4().to_string()),
..Default::default()
};
RTDThemeParametersBuilder { inner }
}
pub fn background_color(&self) -> i64 {
self.background_color
}
pub fn secondary_background_color(&self) -> i64 {
self.secondary_background_color
}
pub fn header_background_color(&self) -> i64 {
self.header_background_color
}
pub fn bottom_bar_background_color(&self) -> i64 {
self.bottom_bar_background_color
}
pub fn section_background_color(&self) -> i64 {
self.section_background_color
}
pub fn section_separator_color(&self) -> i64 {
self.section_separator_color
}
pub fn text_color(&self) -> i64 {
self.text_color
}
pub fn accent_text_color(&self) -> i64 {
self.accent_text_color
}
pub fn section_header_text_color(&self) -> i64 {
self.section_header_text_color
}
pub fn subtitle_text_color(&self) -> i64 {
self.subtitle_text_color
}
pub fn destructive_text_color(&self) -> i64 {
self.destructive_text_color
}
pub fn hint_color(&self) -> i64 {
self.hint_color
}
pub fn link_color(&self) -> i64 {
self.link_color
}
pub fn button_color(&self) -> i64 {
self.button_color
}
pub fn button_text_color(&self) -> i64 {
self.button_text_color
}
}
#[doc(hidden)]
pub struct RTDThemeParametersBuilder {
inner: ThemeParameters,
}
impl RTDThemeParametersBuilder {
pub fn build(&self) -> ThemeParameters {
self.inner.clone()
}
pub fn background_color(&mut self, background_color: i64) -> &mut Self {
self.inner.background_color = background_color;
self
}
pub fn secondary_background_color(&mut self, secondary_background_color: i64) -> &mut Self {
self.inner.secondary_background_color = secondary_background_color;
self
}
pub fn header_background_color(&mut self, header_background_color: i64) -> &mut Self {
self.inner.header_background_color = header_background_color;
self
}
pub fn bottom_bar_background_color(&mut self, bottom_bar_background_color: i64) -> &mut Self {
self.inner.bottom_bar_background_color = bottom_bar_background_color;
self
}
pub fn section_background_color(&mut self, section_background_color: i64) -> &mut Self {
self.inner.section_background_color = section_background_color;
self
}
pub fn section_separator_color(&mut self, section_separator_color: i64) -> &mut Self {
self.inner.section_separator_color = section_separator_color;
self
}
pub fn text_color(&mut self, text_color: i64) -> &mut Self {
self.inner.text_color = text_color;
self
}
pub fn accent_text_color(&mut self, accent_text_color: i64) -> &mut Self {
self.inner.accent_text_color = accent_text_color;
self
}
pub fn section_header_text_color(&mut self, section_header_text_color: i64) -> &mut Self {
self.inner.section_header_text_color = section_header_text_color;
self
}
pub fn subtitle_text_color(&mut self, subtitle_text_color: i64) -> &mut Self {
self.inner.subtitle_text_color = subtitle_text_color;
self
}
pub fn destructive_text_color(&mut self, destructive_text_color: i64) -> &mut Self {
self.inner.destructive_text_color = destructive_text_color;
self
}
pub fn hint_color(&mut self, hint_color: i64) -> &mut Self {
self.inner.hint_color = hint_color;
self
}
pub fn link_color(&mut self, link_color: i64) -> &mut Self {
self.inner.link_color = link_color;
self
}
pub fn button_color(&mut self, button_color: i64) -> &mut Self {
self.inner.button_color = button_color;
self
}
pub fn button_text_color(&mut self, button_text_color: i64) -> &mut Self {
self.inner.button_text_color = button_text_color;
self
}
}
impl AsRef<ThemeParameters> for ThemeParameters {
fn as_ref(&self) -> &ThemeParameters {
self
}
}
impl AsRef<ThemeParameters> for RTDThemeParametersBuilder {
fn as_ref(&self) -> &ThemeParameters {
&self.inner
}
}