import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';

import '../../../consts/consts.dart';

part 'id_value.g.dart';

@JsonSerializable(explicitToJson: true)
@embedded
class IdValue {
  IdValue();

  int? id;
  String? value;

  factory IdValue.fromJson(Map<String, dynamic> json) =>
      _$IdValueFromJson(json);

  toJson() =>
      (prefs.getBool('extended_json') == true) ? _$IdValueToJson(this) : id;
}
