import 'package:freezed_annotation/freezed_annotation.dart';

part 'equipment_dto.freezed.dart';
part 'equipment_dto.g.dart';

@freezed
class EquipmentDto with _$EquipmentDto {
  const factory EquipmentDto({
    required int id,
    @JsonKey(name: 'serial_number') required String serialNumber,
    required String name,
    String? category,
    String? manufacturer,
    String? model,
    required String status,
    @JsonKey(name: 'company_id') required int companyId,
    @JsonKey(name: 'company_name') String? companyName,
    @JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
    @JsonKey(name: 'warehouse_name') String? warehouseName,
    @JsonKey(name: 'purchase_date') String? purchaseDate,
    @JsonKey(name: 'purchase_price') double? purchasePrice,
    @JsonKey(name: 'current_value') double? currentValue,
    @JsonKey(name: 'warranty_expiry') String? warrantyExpiry,
    @JsonKey(name: 'last_maintenance_date') String? lastMaintenanceDate,
    @JsonKey(name: 'next_maintenance_date') String? nextMaintenanceDate,
    Map<String, dynamic>? specifications,
    String? notes,
    @JsonKey(name: 'created_at') DateTime? createdAt,
    @JsonKey(name: 'updated_at') DateTime? updatedAt,
  }) = _EquipmentDto;

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