// Persistent, bar-native privacy state. Signal Glass handles transitions; this
// remains until the underlying capture activity actually ends.

import QtQuick
import qs.config
import qs.services
import qs.widgets

Pill {
    id: root

    visible: PrivacyState.anyActive
    horizontalPadding: 8
    onActivated: ShellState.toggle("activity")

    // Right-click opens the settings that govern this widget. Camera, microphone and screen-sharing state is a privacy readout.
    onSecondaryActivated: ShellState.openSettings("privacy")

    Text {
        anchors.verticalCenter: parent.verticalCenter
        text: {
            if (PrivacyState.recordingActive)
                return "\u{F044A}";
            if (PrivacyState.screenSharingActive)
                return "\u{F0379}";
            if (PrivacyState.cameraActive)
                return "\u{F0100}";
            return "\u{F036C}";
        }
        color: PrivacyState.recordingActive ? Theme.danger : Theme.warn
        font.family: Theme.fontMono
        font.pixelSize: 14
    }

    Text {
        anchors.verticalCenter: parent.verticalCenter
        visible: PrivacyState.activeKinds.length > 1
        text: String(PrivacyState.activeKinds.length)
        color: Theme.fg
        font.family: Theme.fontFamily
        font.features: Theme.tabularFigures
        font.pixelSize: Theme.fontSizeSmall
        font.weight: Font.DemiBold
    }
}
