import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:recording_tool/features/recording/widgets/widget_recording_hint_chip.dart';

/// 权限相关设置提示条
class RecordingSetupHintsWidget extends StatelessWidget {
  const RecordingSetupHintsWidget({
    super.key,
    required this.hasDndAccess,
    required this.isBatteryIgnored,
    required this.notificationsGranted,
    required this.onOpenDnd,
    required this.onOpenBattery,
    required this.onOpenNotificationSettings,
  });

  final bool hasDndAccess;
  final bool isBatteryIgnored;
  final bool notificationsGranted;
  final VoidCallback onOpenDnd;
  final VoidCallback onOpenBattery;
  final VoidCallback onOpenNotificationSettings;

  @override
  Widget build(BuildContext context) {
    final showPermissionHints =
        !hasDndAccess || !isBatteryIgnored || !notificationsGranted;
    if (!showPermissionHints) {
      return const SizedBox.shrink();
    }

    return Padding(
      padding: EdgeInsets.symmetric(horizontal: 16.r, vertical: 8.r),
      child: Column(
        children: [
          if (!notificationsGranted) ...[
            RecordingHintChipWidget(
              label: '开启通知权限以显示录制前台服务',
              onTap: onOpenNotificationSettings,
            ),
            SizedBox(height: 8.h),
          ],
          if (!hasDndAccess)
            RecordingHintChipWidget(label: '开启勿扰权限可减少录制中断', onTap: onOpenDnd),
          if (!isBatteryIgnored) ...[
            SizedBox(height: 8.h),
            RecordingHintChipWidget(
              label: '关闭电池优化可提升息屏续录稳定性',
              onTap: onOpenBattery,
            ),
          ],
        ],
      ),
    );
  }
}
