use serde::{Deserialize, Serialize};
use std::fmt;
use zbus::zvariant::{Type, Value};
#[derive(Copy, Clone, Debug, Eq, PartialEq, Type, Deserialize)]
#[zvariant(signature = "s")]
pub enum Orientation {
#[serde(alias = "horizontal")]
Horizontal,
#[serde(alias = "vertical")]
Vertical,
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Type, Serialize)]
#[zvariant(signature = "s")]
pub enum Category {
ApplicationStatus,
Communications,
SystemServices,
Hardware,
}
impl From<Category> for Value<'_> {
fn from(value: Category) -> Self {
value.to_string().into()
}
}
impl fmt::Display for Category {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
self.serialize(f)
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Type, Serialize)]
#[zvariant(signature = "s")]
pub enum Status {
Passive,
Active,
NeedsAttention,
}
impl From<Status> for Value<'_> {
fn from(value: Status) -> Self {
value.to_string().into()
}
}
impl fmt::Display for Status {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
self.serialize(f)
}
}
#[derive(Clone, Debug, Default, Hash, Type, Value, Serialize)]
pub struct ToolTip {
pub icon_name: String,
pub icon_pixmap: Vec<Icon>,
pub title: String,
pub description: String,
}
#[derive(Clone, Debug, Hash, Type, Value, Serialize)]
pub struct Icon {
pub width: i32,
pub height: i32,
pub data: Vec<u8>,
}