// ignore_for_file: unnecessary_getters_setters

import 'package:hub/features/backend/index.dart';
import 'package:hub/flutter_flow/nav/nav.dart';

import 'index.dart';

class DeviceStruct extends BaseStruct {
  DeviceStruct({
    String? devUUID,
    String? version,
    String? description,
  })  : _devUUID = devUUID,
        _version = version,
        _description = description;

  // "devUUID" field.
  String? _devUUID;
  String get devUUID => _devUUID ?? '';
  set devUUID(String? val) => _devUUID = val;

  bool hasDevUUID() => _devUUID != null;

  // "version" field.
  String? _version;
  String get version => _version ?? '';
  set version(String? val) => _version = val;

  bool hasVersion() => _version != null;

  // "description" field.
  String? _description;
  String get description => _description ?? '';
  set description(String? val) => _description = val;

  bool hasDescription() => _description != null;

  static DeviceStruct fromMap(Map<String, dynamic> data) => DeviceStruct(
        devUUID: data['devUUID'] as String?,
        version: data['version'] as String?,
        description: data['description'] as String?,
      );

  static DeviceStruct? maybeFromMap(dynamic data) =>
      data is Map ? DeviceStruct.fromMap(data.cast<String, dynamic>()) : null;

  Map<String, dynamic> toMap() => {
        'devUUID': _devUUID,
        'version': _version,
        'description': _description,
      }.withoutNulls;

  @override
  Map<String, dynamic> toSerializableMap() => {
        'devUUID': serializeParam(
          _devUUID,
          ParamType.String,
        ),
        'version': serializeParam(
          _version,
          ParamType.String,
        ),
        'description': serializeParam(
          _description,
          ParamType.String,
        ),
      }.withoutNulls;

  static DeviceStruct fromSerializableMap(Map<String, dynamic> data) =>
      DeviceStruct(
        devUUID: deserializeParam(
          data['devUUID'],
          ParamType.String,
          false,
        ),
        version: deserializeParam(
          data['version'],
          ParamType.String,
          false,
        ),
        description: deserializeParam(
          data['description'],
          ParamType.String,
          false,
        ),
      );

  @override
  String toString() => 'DeviceStruct(${toMap()})';

  @override
  bool operator ==(Object other) {
    return other is DeviceStruct &&
        devUUID == other.devUUID &&
        version == other.version &&
        description == other.description;
  }

  @override
  int get hashCode =>
      const ListEquality().hash([devUUID, version, description]);
}

DeviceStruct createDeviceStruct({
  String? devUUID,
  String? version,
  String? description,
}) =>
    DeviceStruct(
      devUUID: devUUID,
      version: version,
      description: description,
    );
