//! 窗口标签定义模块
//!
//! 提供窗口标签的类型安全常量，避免硬编码字符串。

use std::fmt::{Display, Formatter};

/// 窗口标签类型
///
/// 提供类型安全的窗口标签常量，避免使用魔法字符串
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct WindowLabel(&'static str);

impl WindowLabel {
    /// 主窗口
    pub const MAIN: Self = Self("main");
    /// 悬浮列表窗口
    pub const FLOAT_LIST: Self = Self("float-list");
    /// 弹出框窗口
    pub const POPUP: Self = Self("popup");
    /// 画板窗口
    pub const DRAWING_BOARD: Self = Self("drawing-board");
    /// 实时字幕窗口
    pub const SUBTITLE: Self = Self("subtitle");
    /// 会议窗口
    pub const MEETING: Self = Self("meeting");
    /// 会议窗口2
    pub const MEETING2: Self = Self("meeting2");
    /// 系统托盘
    pub const MAIN_TRAY: Self = Self("main");
}

impl Display for WindowLabel {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}

impl AsRef<str> for WindowLabel {
    fn as_ref(&self) -> &str {
        self.0
    }
}

impl From<WindowLabel> for String {
    fn from(label: WindowLabel) -> Self {
        label.0.to_string()
    }
}

impl From<WindowLabel> for &'static str {
    fn from(label: WindowLabel) -> Self {
        label.0
    }
}

impl<'a> From<&'a WindowLabel> for &'a str {
    fn from(label: &'a WindowLabel) -> Self {
        label.0
    }
}
