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

part 'material.g.dart';

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

  @JsonKey(name: 'Name Material')
  @Index(unique: true, hash: true)
  String? name;
  @JsonKey(name: 'Bezugsquelle')
  List<IdValueColor>? sourceOfSupply;
  @JsonKey(name: 'Durchschnittlicher Preis')
  double? averagePrice;

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

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