import 'package:ambito/src/entity/base_entity.dart';
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';

import '../_general/file/file_part.dart';
import '../_general/file/thumbnail.dart';
import '../_general/file/thumbnails.dart';
import '../_general/id_value/id_value.dart';
import '../_general/id_value_color/id_value_color.dart';

part 'measure_grouping.g.dart';

@collection
@JsonSerializable(explicitToJson: true)
class MeasureGrouping extends BaseEntity with EntityWithId {
  MeasureGrouping();

  @JsonKey(name: 'Maßnahmentyp')
  @Index()
  String? name;
  @JsonKey(name: 'Flächentyp Factsheet')
  List<IdValueColor>? categories;
  @JsonKey(name: "Maßnahmengruppe")
  IdValueColor? type;
  @JsonKey(name: "Datei")
  List<FilePart>? files;
  @JsonKey(name: 'Definition Factsheet')
  String? description;
  @JsonKey(name: 'Factsheet_Status')
  List<IdValue>? subtype;

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

  Map<String, dynamic> toJson() => _$MeasureGroupingToJson(this);
}
