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

part 'source.g.dart';

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

  @JsonKey(name: 'Titel')
  @Index()
  String? title;
  @JsonKey(name: '00 Maßnahmen_Main')
  List<IdValue>? measures;
  @JsonKey(name: 'Tag')
  List<IdValueColor>? tags;
  @JsonKey(name: 'Erscheinungsjahr')
  String? publicationYear;
  @JsonKey(name: 'Link Webseite')
  String? url;
  @JsonKey(name: 'DOI')
  String? doi;
  @JsonKey(name: 'Quellart')
  List<IdValueColor>? typeOfSource;
  @JsonKey(name: 'Datei')
  List<FilePart>? files;
  @JsonKey(name: 'Link zu Server')
  String? serverUrl;
  @JsonKey(name: 'Autor/in')
  List<IdValueColor>? authors;
  @JsonKey(name: 'Seiten')
  String? pages;
  @JsonKey(name: 'Verwendet in Maßnahmendatenblatt')
  List<IdValue>? usedInFactsheet;
  @JsonKey(name: 'Anmerkung')
  String? note;

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

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