<!-- 🔔 通知设置页面 -->
<view class="notification-settings-container">
  <!-- 自定义导航栏 -->
  <view class="custom-navbar" style="padding-top: {{statusBarHeight}}px;">
    <view class="navbar-content" style="height: {{navBarHeight}}px;">
      <view class="navbar-left" bindtap="goBack">
        <text class="back-icon">‹</text>
      </view>
      
      <view class="navbar-title">
        <text class="title-text">通知设置</text>
      </view>
      
      <view class="navbar-right"></view>
    </view>
  </view>

  <!-- 页面内容 -->
  <scroll-view class="page-content" scroll-y="true">
    <!-- 通知总开关 -->
    <view class="settings-section">
      <view class="section-header">
        <text class="section-title">通知总开关</text>
      </view>
      
      <view class="setting-item">
        <view class="item-info">
          <text class="item-title">接收通知</text>
          <text class="item-desc">关闭后将不会收到任何通知</text>
        </view>
        <switch class="setting-switch"
                checked="{{notificationSettings.enabled}}"
                bindchange="onNotificationEnabledChange" />
      </view>
    </view>

    <!-- 消息通知 -->
    <view class="settings-section" wx:if="{{notificationSettings.enabled}}">
      <view class="section-header">
        <text class="section-title">消息通知</text>
      </view>
      
      <view class="setting-item">
        <view class="item-info">
          <text class="item-title">新消息通知</text>
          <text class="item-desc">收到新消息时显示通知</text>
        </view>
        <switch class="setting-switch"
                checked="{{notificationSettings.message.enabled}}"
                bindchange="onMessageNotificationChange" />
      </view>
      
      <view class="setting-item" wx:if="{{notificationSettings.message.enabled}}">
        <view class="item-info">
          <text class="item-title">消息预览</text>
          <text class="item-desc">在通知中显示消息内容</text>
        </view>
        <switch class="setting-switch"
                checked="{{notificationSettings.message.showPreview}}"
                bindchange="onMessagePreviewChange" />
      </view>
      
      <view class="setting-item" wx:if="{{notificationSettings.message.enabled}}">
        <view class="item-info">
          <text class="item-title">消息提示音</text>
          <text class="item-desc">收到消息时播放提示音</text>
        </view>
        <switch class="setting-switch"
                checked="{{notificationSettings.message.sound}}"
                bindchange="onMessageSoundChange" />
      </view>
      
      <view class="setting-item" wx:if="{{notificationSettings.message.enabled}}">
        <view class="item-info">
          <text class="item-title">消息震动</text>
          <text class="item-desc">收到消息时震动提醒</text>
        </view>
        <switch class="setting-switch"
                checked="{{notificationSettings.message.vibrate}}"
                bindchange="onMessageVibrateChange" />
      </view>
      
      <view class="setting-item" wx:if="{{notificationSettings.message.enabled}}">
        <view class="item-info">
          <text class="item-title">按聊天分组</text>
          <text class="item-desc">将同一聊天的消息合并显示</text>
        </view>
        <switch class="setting-switch"
                checked="{{notificationSettings.message.groupByChat}}"
                bindchange="onMessageGroupChange" />
      </view>
    </view>

    <!-- 群聊通知 -->
    <view class="settings-section" wx:if="{{notificationSettings.enabled}}">
      <view class="section-header">
        <text class="section-title">群聊通知</text>
      </view>
      
      <view class="setting-item">
        <view class="item-info">
          <text class="item-title">群聊消息</text>
          <text class="item-desc">收到群聊消息时显示通知</text>
        </view>
        <switch class="setting-switch"
                checked="{{notificationSettings.group.enabled}}"
                bindchange="onGroupNotificationChange" />
      </view>
      
      <view class="setting-item" wx:if="{{notificationSettings.group.enabled}}">
        <view class="item-info">
          <text class="item-title">仅@我的消息</text>
          <text class="item-desc">只有@我的群聊消息才通知</text>
        </view>
        <switch class="setting-switch"
                checked="{{notificationSettings.group.mentionOnly}}"
                bindchange="onGroupMentionOnlyChange" />
      </view>
      
      <view class="setting-item" wx:if="{{notificationSettings.group.enabled}}">
        <view class="item-info">
          <text class="item-title">群聊提示音</text>
          <text class="item-desc">收到群聊消息时播放提示音</text>
        </view>
        <switch class="setting-switch"
                checked="{{notificationSettings.group.sound}}"
                bindchange="onGroupSoundChange" />
      </view>
      
      <view class="setting-item" wx:if="{{notificationSettings.group.enabled}}">
        <view class="item-info">
          <text class="item-title">群聊震动</text>
          <text class="item-desc">收到群聊消息时震动提醒</text>
        </view>
        <switch class="setting-switch"
                checked="{{notificationSettings.group.vibrate}}"
                bindchange="onGroupVibrateChange" />
      </view>
    </view>

    <!-- 好友通知 -->
    <view class="settings-section" wx:if="{{notificationSettings.enabled}}">
      <view class="section-header">
        <text class="section-title">好友通知</text>
      </view>
      
      <view class="setting-item">
        <view class="item-info">
          <text class="item-title">好友请求</text>
          <text class="item-desc">收到好友请求时显示通知</text>
        </view>
        <switch class="setting-switch"
                checked="{{notificationSettings.friend.enabled}}"
                bindchange="onFriendNotificationChange" />
      </view>
      
      <view class="setting-item" wx:if="{{notificationSettings.friend.enabled}}">
        <view class="item-info">
          <text class="item-title">好友提示音</text>
          <text class="item-desc">收到好友通知时播放提示音</text>
        </view>
        <switch class="setting-switch"
                checked="{{notificationSettings.friend.sound}}"
                bindchange="onFriendSoundChange" />
      </view>
    </view>

    <!-- 系统通知 -->
    <view class="settings-section" wx:if="{{notificationSettings.enabled}}">
      <view class="section-header">
        <text class="section-title">系统通知</text>
      </view>
      
      <view class="setting-item">
        <view class="item-info">
          <text class="item-title">系统消息</text>
          <text class="item-desc">接收系统通知和公告</text>
        </view>
        <switch class="setting-switch"
                checked="{{notificationSettings.system.enabled}}"
                bindchange="onSystemNotificationChange" />
      </view>
    </view>

    <!-- 免打扰模式 -->
    <view class="settings-section" wx:if="{{notificationSettings.enabled}}">
      <view class="section-header">
        <text class="section-title">免打扰模式</text>
      </view>
      
      <view class="setting-item">
        <view class="item-info">
          <text class="item-title">开启免打扰</text>
          <text class="item-desc">在指定时间段内不接收通知</text>
        </view>
        <switch class="setting-switch"
                checked="{{doNotDisturb.enabled}}"
                bindchange="onDoNotDisturbChange" />
      </view>
      
      <view class="setting-item" wx:if="{{doNotDisturb.enabled}}">
        <view class="item-info">
          <text class="item-title">开始时间</text>
          <text class="item-desc">免打扰开始时间</text>
        </view>
        <view class="item-action" bindtap="selectStartTime">
          <text class="action-text">{{doNotDisturb.startTime}}</text>
          <text class="action-arrow">›</text>
        </view>
      </view>
      
      <view class="setting-item" wx:if="{{doNotDisturb.enabled}}">
        <view class="item-info">
          <text class="item-title">结束时间</text>
          <text class="item-desc">免打扰结束时间</text>
        </view>
        <view class="item-action" bindtap="selectEndTime">
          <text class="action-text">{{doNotDisturb.endTime}}</text>
          <text class="action-arrow">›</text>
        </view>
      </view>
      
      <view class="setting-item" wx:if="{{doNotDisturb.enabled}}">
        <view class="item-info">
          <text class="item-title">允许紧急通知</text>
          <text class="item-desc">免打扰期间仍接收紧急通知</text>
        </view>
        <switch class="setting-switch"
                checked="{{doNotDisturb.allowUrgent}}"
                bindchange="onAllowUrgentChange" />
      </view>
      
      <view class="setting-item" wx:if="{{doNotDisturb.enabled}}">
        <view class="item-info">
          <text class="item-title">允许@提醒</text>
          <text class="item-desc">免打扰期间仍接收@提醒</text>
        </view>
        <switch class="setting-switch"
                checked="{{doNotDisturb.allowMentions}}"
                bindchange="onAllowMentionsChange" />
      </view>
    </view>

    <!-- 通知历史 -->
    <view class="settings-section">
      <view class="section-header">
        <text class="section-title">通知管理</text>
      </view>
      
      <view class="setting-item" bindtap="viewNotificationHistory">
        <view class="item-info">
          <text class="item-title">通知历史</text>
          <text class="item-desc">查看最近的通知记录</text>
        </view>
        <view class="item-action">
          <text class="unread-badge" wx:if="{{unreadCount > 0}}">{{unreadCount}}</text>
          <text class="action-arrow">›</text>
        </view>
      </view>
      
      <view class="setting-item" bindtap="clearNotificationHistory">
        <view class="item-info">
          <text class="item-title">清空通知历史</text>
          <text class="item-desc">删除所有通知记录</text>
        </view>
        <text class="action-arrow">›</text>
      </view>
    </view>

    <!-- 订阅消息 -->
    <view class="settings-section">
      <view class="section-header">
        <text class="section-title">订阅消息</text>
      </view>
      
      <view class="setting-item" bindtap="requestSubscribeMessage">
        <view class="item-info">
          <text class="item-title">订阅消息权限</text>
          <text class="item-desc">允许应用发送订阅消息</text>
        </view>
        <text class="action-arrow">›</text>
      </view>
      
      <view class="setting-item" bindtap="viewSubscribeStatus">
        <view class="item-info">
          <text class="item-title">订阅状态</text>
          <text class="item-desc">查看当前订阅消息状态</text>
        </view>
        <text class="action-arrow">›</text>
      </view>
    </view>

    <!-- 重置设置 -->
    <view class="settings-section">
      <view class="setting-item danger" bindtap="resetSettings">
        <view class="item-info">
          <text class="item-title danger">重置通知设置</text>
          <text class="item-desc">恢复所有通知设置为默认值</text>
        </view>
        <text class="action-arrow">›</text>
      </view>
    </view>
  </scroll-view>
</view>

<!-- 时间选择器 -->
<picker wx:if="{{showTimePicker}}"
        mode="time"
        value="{{selectedTime}}"
        bindchange="onTimeChange"
        bindcancel="onTimeCancel">
</picker>
