import 'package:equatable/equatable.dart';

/// 用途：首页监护舱顶部环境与护理指标数据
/// 涉及页面：首页监护舱页面
class MonitoringMetricBO extends Equatable {
  /// 指标数值
  final String value;

  /// 指标单位
  final String unit;

  /// 指标名称
  final String label;

  /// 指标边框颜色值
  final int borderColorValue;

  /// 指标背景颜色值
  final int backgroundColorValue;

  const MonitoringMetricBO({
    required this.value,
    required this.unit,
    required this.label,
    this.borderColorValue = 0xFF999999,
    this.backgroundColorValue = 0x1A999999,
  });

  factory MonitoringMetricBO.fromJson(Map<String, dynamic> json) {
    return MonitoringMetricBO(
      value: json['value'] as String? ?? '',
      unit: json['unit'] as String? ?? '',
      label: json['label'] as String? ?? '',
      borderColorValue: json['borderColorValue'] as int? ?? 0xFF999999,
      backgroundColorValue: json['backgroundColorValue'] as int? ?? 0x1A999999,
    );
  }

  @override
  List<Object?> get props => [
        value,
        unit,
        label,
        borderColorValue,
        backgroundColorValue,
      ];
}

/// 用途：首页监护舱患者信息展示数据
/// 涉及页面：首页监护舱页面
class PatientInfoBO extends Equatable {
  /// 患者名称
  final String name;

  /// 宠物类型（猫/狗等）
  final String type;

  /// 联系电话
  final String phone;

  /// 患者品种
  final String breed;

  /// 负责医生
  final String doctor;

  /// 患者头像地址
  final String avatarUrl;

  /// 宠物病因
  final String disease;

  /// 入住时间
  final String checkInDate;

  /// 护理等级
  final String careLevel;

  const PatientInfoBO({
    required this.name,
    required this.type,
    required this.phone,
    required this.breed,
    required this.doctor,
    required this.disease,
    required this.checkInDate,
    required this.careLevel,
    this.avatarUrl = '',
  });

  factory PatientInfoBO.fromJson(Map<String, dynamic> json) {
    return PatientInfoBO(
      name: json['name'] as String? ?? '',
      type: json['type'] as String? ?? '',
      phone: json['phone'] as String? ?? '',
      breed: json['breed'] as String? ?? '',
      doctor: json['doctor'] as String? ?? '',
      disease: json['disease'] as String? ?? '',
      checkInDate: json['checkInDate'] as String? ?? '',
      careLevel: json['careLevel'] as String? ?? '',
      avatarUrl: json['avatarUrl'] as String? ?? '',
    );
  }

  @override
  List<Object?> get props =>
      [name, type, phone, breed, doctor, disease, checkInDate, careLevel, avatarUrl];
}

/// 用途：首页监护舱告警信息展示数据
/// 涉及页面：首页监护舱页面
class AlertInfoBO extends Equatable {
  /// 告警标题
  final String title;

  /// 告警描述
  final String description;

  /// 告警时间
  final String time;

  /// 告警处理状态
  final String status;

  const AlertInfoBO({
    required this.title,
    required this.description,
    required this.time,
    this.status = '已处理',
  });

  factory AlertInfoBO.fromJson(Map<String, dynamic> json) {
    return AlertInfoBO(
      title: json['title'] as String? ?? '',
      description: json['description'] as String? ?? '',
      time: json['time'] as String? ?? '',
      status: json['status'] as String? ?? '已处理',
    );
  }

  @override
  List<Object?> get props => [title, description, time, status];
}

/// 用途：首页监护舱右侧设备菜单数据
/// 涉及页面：首页监护舱页面
class MonitoringMenuItemBO extends Equatable {
  /// 菜单ID
  final String id;

  /// 菜单标题
  final String title;

  /// 菜单图标（emoji或文字，用于旧版本兼容）
  final String icon;

  /// 菜单图标路径（新版本）
  final String iconPath;

  /// 是否为TSAAS特殊样式
  final bool isTsaas;

  const MonitoringMenuItemBO({
    required this.id,
    required this.title,
    this.icon = '',
    this.iconPath = '',
    this.isTsaas = false,
  });

  factory MonitoringMenuItemBO.fromJson(Map<String, dynamic> json) {
    return MonitoringMenuItemBO(
      id: json['id'] as String? ?? '',
      title: json['title'] as String? ?? '',
      icon: json['icon'] as String? ?? '',
      iconPath: json['iconPath'] as String? ?? '',
      isTsaas: json['isTsaas'] as bool? ?? false,
    );
  }

  @override
  List<Object?> get props => [id, title, icon, iconPath, isTsaas];
}
