// MARK: - Window Monitoring

/// Configuration for the window monitor.
#[derive(Debug, Clone, Copy)]
pub struct MonitorConfig {
    /// Whether to include the app icon.
    ///
    /// Default: `false`
    pub include_app_icon: bool,

    /// Whether to include the app display color when `include_app_icon` is enabled.
    ///
    /// Default: `false`
    pub include_app_color: bool,

    /// Whether to extract browser info (URL and private mode).
    ///
    /// When enabled, extracts the current URL and private/incognito mode from browser windows.
    /// Populates the `browser` field in `WindowInfo`.
    ///
    /// Default: `false`
    pub include_browser_info: bool,

    /// Whether to extract website info (hostname, favicon, and color).
    ///
    /// When enabled, extracts the hostname from the browser URL, fetches the favicon,
    /// and extracts the favicon-derived color. Populates `browser.website` in `WindowInfo`.
    ///
    /// Requires `include_browser_info` to be enabled (needs URL to fetch favicon).
    /// Network fetch, slower (~50-500ms), cached by hostname.
    ///
    /// Default: `false`
    pub include_website_info: bool,

    /// Whether to track focused window changes in addition to app activations.
    ///
    /// When `true` (default), fires events for:
    /// - Window focus changes within the same app
    /// - Window title changes (e.g. tab switches in browsers)
    /// - Window information becoming available after app activation
    ///
    /// App activation events are always emitted. Set this to `false` to disable
    /// `WindowChanged` events while still receiving `AppActivated` events.
    ///
    /// Default: `true`
    pub track_window_changes: bool,

    /// Whether to track focused window move and resize changes.
    ///
    /// When `true`, fires `WindowBoundsChanged` events for the focused window.
    /// This is separate from `track_window_changes` so consumers can receive
    /// geometry updates without routing them through `WindowChanged`.
    ///
    /// Default: `false`
    pub track_window_bounds_changes: bool,
}

impl Default for MonitorConfig {
    fn default() -> Self {
        Self {
            include_app_icon: false,
            include_app_color: false,
            include_browser_info: false,
            include_website_info: false,
            track_window_changes: true,
            track_window_bounds_changes: false,
        }
    }
}

/// Configuration for querying window/app information.
#[derive(Debug, Clone, Copy)]
pub struct QueryConfig {
    /// Whether to include the app icon.
    ///
    /// Default: `false`
    pub include_app_icon: bool,

    /// Whether to include the app display color when `include_app_icon` is enabled.
    ///
    /// Default: `false`
    pub include_app_color: bool,

    /// Whether to extract browser info (URL and private mode).
    ///
    /// When enabled, extracts the current URL and private/incognito mode from browser windows.
    /// Populates the `browser` field in `WindowInfo`.
    ///
    /// Default: `false`
    pub include_browser_info: bool,

    /// Whether to extract website info (hostname, favicon, and color).
    ///
    /// When enabled, extracts the hostname from the browser URL, fetches the favicon,
    /// and extracts the favicon-derived color. Populates `browser.website` in `WindowInfo`.
    ///
    /// Requires `include_browser_info` to be enabled (needs URL to fetch favicon).
    /// Network fetch, slower (~50-500ms), cached by hostname.
    ///
    /// Default: `false`
    pub include_website_info: bool,
}

impl Default for QueryConfig {
    fn default() -> Self {
        Self {
            include_app_icon: false,
            include_app_color: false,
            include_browser_info: false,
            include_website_info: false,
        }
    }
}

// MARK: - App Information

/// Configuration for scanning installed applications.
#[derive(Debug, Clone, Copy)]
pub struct InstalledAppsConfig {
    /// Include icon in the results.
    ///
    /// Default: `false` (faster without icon)
    pub include_icon: bool,

    /// Whether to include the app display color when `include_icon` is enabled.
    ///
    /// Default: `false`
    pub include_app_color: bool,

    /// Icon size in pixels.
    ///
    /// Only used when `include_icon` is true.
    ///
    /// Default: `32`
    pub icon_size: u32,
}

impl Default for InstalledAppsConfig {
    fn default() -> Self {
        Self {
            include_icon: false,
            include_app_color: false,
            icon_size: 32,
        }
    }
}
