import 'package:test_sa/models/base.dart';

class AssetGroup extends Base {
  final int? id;
  final String? code;
  final String? displayName;

  AssetGroup({
    this.id,
    this.code,
    this.displayName,
  }) : super(identifier: id?.toString(), name: displayName);

  factory AssetGroup.fromJson(Map<String, dynamic> json) {
    return AssetGroup(
      id: json['id'],
      code: json['code'],
      displayName: json['name'],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'code': code,
      'name': displayName,
    };
  }

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is AssetGroup &&
          runtimeType == other.runtimeType &&
          id == other.id;

  @override
  int get hashCode => id.hashCode;
}
