import 'package:garage/insurance/model/currency.dart';
import 'package:json_annotation/json_annotation.dart';

part 'insurance.g.dart';

@JsonSerializable(explicitToJson: true)
class Insurance {
  final String contractNumber;
  final String company;
  final int amount;
  final Currency currency;
  final DateTime expirationDate;

  Insurance({
    required this.company,
    required this.contractNumber,
    required this.amount,
    required this.currency,
    required this.expirationDate,
  });

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

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

  @override
  String toString() {
    return 'Insurance{amount: $amount, expirationInsurance: $expirationDate}';
  }
}
