/// 音视频硬件设置
class HardwareSetting {
  HardwareSetting._internal();

  static HardwareSetting? _instance;

  /// 获取单例
  static HardwareSetting get ins {
    if (_instance == null) {
      _instance = HardwareSetting._internal();
    }
    return _instance!;
  }

  String _idealWebVideoInputDeviceName = '';
  String _idealWebAudioInputDeviceName = '';

  /// 推荐的Web端摄像头设备
  String get idealWebVideoInputDeviceName => _idealWebVideoInputDeviceName;

  /// 推荐的Web端麦克风设备
  String get idealWebAudioInputDeviceName => _idealWebAudioInputDeviceName;

  /// 设置推荐的Web端摄像头设备
  void setIdealWebVideoInputDeviceName(String deviceName) {
    _idealWebVideoInputDeviceName = deviceName;
  }

  /// 设置推荐的Web端麦克风设备
  void setIdealWebAudioInputDeviceName(String deviceName) {
    _idealWebAudioInputDeviceName = deviceName;
  }

  /// 从json中初始化数据
  void setDataFromJson(Map<String, dynamic> json) {
    _idealWebVideoInputDeviceName = json['idealWebVideoInputDeviceName'];
    _idealWebAudioInputDeviceName = json['idealWebAudioInputDeviceName'];
  }

  /// 当前实体转为json
  Map<String, dynamic> toJson() => {
        'idealWebVideoInputDeviceName': _idealWebVideoInputDeviceName,
        'idealWebAudioInputDeviceName': _idealWebAudioInputDeviceName,
      };
}
