import 'package:freezed_annotation/freezed_annotation.dart';

part 'overview_stats.freezed.dart';
part 'overview_stats.g.dart';

@freezed
class OverviewStats with _$OverviewStats {
  const factory OverviewStats({
    @JsonKey(name: 'total_companies') required int totalCompanies,
    @JsonKey(name: 'active_companies') required int activeCompanies,
    @JsonKey(name: 'total_users') required int totalUsers,
    @JsonKey(name: 'active_users') required int activeUsers,
    @JsonKey(name: 'total_equipment') required int totalEquipment,
    @JsonKey(name: 'available_equipment') required int availableEquipment,
    @JsonKey(name: 'in_use_equipment') required int inUseEquipment,
    @JsonKey(name: 'maintenance_equipment') required int maintenanceEquipment,
    @JsonKey(name: 'total_licenses') required int totalLicenses,
    @JsonKey(name: 'active_licenses') required int activeLicenses,
    @JsonKey(name: 'expiring_licenses_count') required int expiringLicensesCount,
    @JsonKey(name: 'expired_licenses_count') required int expiredLicensesCount,
    @JsonKey(name: 'total_warehouse_locations') required int totalWarehouseLocations,
    @JsonKey(name: 'active_warehouse_locations') required int activeWarehouseLocations,
    // 다음 필드들은 백엔드에 없으므로 선택적으로 만듭니다
    @JsonKey(name: 'total_rentals', defaultValue: 0) int? totalRentals,
    @JsonKey(name: 'active_rentals', defaultValue: 0) int? activeRentals,
  }) = _OverviewStats;

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