<?php

namespace Kylin\AntiAddiction\Enums;

/**
 * 弹窗类型枚举
 *
 * 防沉迷系统向用户展示的各类弹窗提示：
 * - real_name_required:  要求实名认证
 * - minor_time_limit:    未成年人时段限制提示
 * - minor_duration_limit: 未成年人时长限制提示
 * - spending_limit:      消费限额提示
 * - curfew_warning:      宵禁警告
 * - face_verify_required: 要求人脸识别
 * - kick_off_warning:    即将被踢下线警告
 * - health_reminder:     健康游戏提醒
 */
enum PopupType: string
{
    case RealNameRequired = 'real_name_required';
    case MinorTimeLimit = 'minor_time_limit';
    case MinorDurationLimit = 'minor_duration_limit';
    case SpendingLimit = 'spending_limit';
    case CurfewWarning = 'curfew_warning';
    case FaceVerifyRequired = 'face_verify_required';
    case KickOffWarning = 'kick_off_warning';
    case HealthReminder = 'health_reminder';

    /**
     * 中文标签
     */
    public function label(): string
    {
        return match ($this) {
            self::RealNameRequired => '实名认证提示',
            self::MinorTimeLimit => '时段限制提示',
            self::MinorDurationLimit => '时长限制提示',
            self::SpendingLimit => '消费限额提示',
            self::CurfewWarning => '宵禁警告',
            self::FaceVerifyRequired => '人脸识别提示',
            self::KickOffWarning => '下线警告',
            self::HealthReminder => '健康提醒',
        };
    }

    /**
     * 弹窗优先级（数值越大优先级越高）
     */
    public function priority(): int
    {
        return match ($this) {
            self::RealNameRequired => 100,
            self::KickOffWarning => 90,
            self::CurfewWarning => 80,
            self::FaceVerifyRequired => 70,
            self::MinorTimeLimit => 60,
            self::MinorDurationLimit => 50,
            self::SpendingLimit => 40,
            self::HealthReminder => 10,
        };
    }
}
