// Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: GPL-3.0-only

use cosmic_settings_page::Entity;

#[cfg(feature = "page-bluetooth")]
pub mod bluetooth;
pub mod desktop;
pub mod display;
#[cfg(feature = "page-input")]
pub mod input;
#[cfg(feature = "page-networking")]
pub mod networking;
#[cfg(feature = "page-power")]
pub mod power;
#[cfg(feature = "page-sound")]
pub mod sound;
pub mod system;
pub mod time;

#[derive(Clone, Debug)]
pub enum Message {
    #[cfg(feature = "page-about")]
    About(system::about::Message),
    Appearance(desktop::appearance::Message),
    #[cfg(feature = "page-bluetooth")]
    Bluetooth(bluetooth::Message),
    #[cfg(feature = "page-input")]
    CustomShortcuts(input::keyboard::shortcuts::custom::Message),
    #[cfg(feature = "page-date")]
    DateAndTime(time::date::Message),
    Desktop(desktop::Message),
    DesktopWallpaper(desktop::wallpaper::Message),
    #[cfg(feature = "page-workspaces")]
    DesktopWorkspaces(desktop::workspaces::Message),
    Displays(display::Message),
    #[cfg(feature = "wayland")]
    Dock(desktop::dock::Message),
    #[cfg(feature = "wayland")]
    DockApplet(desktop::dock::applets::Message),
    External {
        id: String,
        message: Vec<u8>,
    },
    #[cfg(feature = "page-input")]
    Input(input::Message),
    #[cfg(feature = "page-input")]
    Keyboard(input::keyboard::Message),
    #[cfg(feature = "page-input")]
    KeyboardShortcuts(input::keyboard::shortcuts::Message),
    #[cfg(feature = "page-input")]
    ManageWindowShortcuts(input::keyboard::shortcuts::ShortcutMessage),
    #[cfg(feature = "page-input")]
    MoveWindowShortcuts(input::keyboard::shortcuts::ShortcutMessage),
    #[cfg(feature = "page-input")]
    NavShortcuts(input::keyboard::shortcuts::ShortcutMessage),
    #[cfg(feature = "page-networking")]
    Networking(networking::Message),
    Page(Entity),
    #[cfg(feature = "wayland")]
    Panel(desktop::panel::Message),
    #[cfg(feature = "wayland")]
    PanelApplet(desktop::panel::applets_inner::Message),
    #[cfg(feature = "page-power")]
    Power(power::Message),
    #[cfg(feature = "page-sound")]
    Sound(sound::Message),
    #[cfg(feature = "page-input")]
    SystemShortcuts(input::keyboard::shortcuts::ShortcutMessage),
    #[cfg(feature = "page-input")]
    TilingShortcuts(input::keyboard::shortcuts::ShortcutMessage),
    #[cfg(feature = "page-networking")]
    Vpn(networking::vpn::Message),
    #[cfg(feature = "page-networking")]
    WiFi(networking::wifi::Message),
    #[cfg(feature = "page-window-management")]
    WindowManagement(desktop::window_management::Message),
    #[cfg(feature = "page-networking")]
    Wired(networking::wired::Message),
}

impl From<Message> for crate::Message {
    fn from(message: Message) -> Self {
        crate::Message::PageMessage(message)
    }
}
