import 'package:freezed_annotation/freezed_annotation.dart';

part 'license_expiry_summary.freezed.dart';
part 'license_expiry_summary.g.dart';

@freezed
class LicenseExpirySummary with _$LicenseExpirySummary {
  const factory LicenseExpirySummary({
    @JsonKey(name: 'expired', defaultValue: 0) required int expired,
    @JsonKey(name: 'expiring_7_days', defaultValue: 0) required int expiring7Days,
    @JsonKey(name: 'expiring_30_days', defaultValue: 0) required int expiring30Days,
    @JsonKey(name: 'expiring_90_days', defaultValue: 0) required int expiring90Days,
    @JsonKey(name: 'active', defaultValue: 0) required int active,
  }) = _LicenseExpirySummary;

  factory LicenseExpirySummary.fromJson(Map<String, dynamic> json) =>
      _$LicenseExpirySummaryFromJson(json);
}

@freezed
class LicenseExpiryDetail with _$LicenseExpiryDetail {
  const factory LicenseExpiryDetail({
    required int id,
    @JsonKey(name: 'equipment_id') required int equipmentId,
    @JsonKey(name: 'equipment_name') required String equipmentName,
    @JsonKey(name: 'serial_number') required String serialNumber,
    @JsonKey(name: 'company_name') required String companyName,
    @JsonKey(name: 'license_type') required String licenseType,
    @JsonKey(name: 'start_date') required String startDate,
    @JsonKey(name: 'end_date') required String endDate,
    @JsonKey(name: 'days_remaining') required int daysRemaining,
    @JsonKey(name: 'is_expired') required bool isExpired,
  }) = _LicenseExpiryDetail;

  factory LicenseExpiryDetail.fromJson(Map<String, dynamic> json) =>
      _$LicenseExpiryDetailFromJson(json);
}