import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:superport/core/utils/equipment_status_converter.dart';

part 'equipment_response.freezed.dart';
part 'equipment_response.g.dart';

@freezed
class EquipmentResponse with _$EquipmentResponse {
  const factory EquipmentResponse({
    required int id,
    required String equipmentNumber,
    String? category1,
    String? category2,
    String? category3,
    required String manufacturer,
    String? modelName,
    String? serialNumber,
    String? barcode,
    DateTime? purchaseDate,
    double? purchasePrice,
    @EquipmentStatusJsonConverter() required String status,
    int? currentCompanyId,
    int? currentBranchId,
    int? warehouseLocationId,
    DateTime? lastInspectionDate,
    DateTime? nextInspectionDate,
    String? remark,
    required DateTime createdAt,
    required DateTime updatedAt,
    // 추가 필드 (조인된 데이터)
    String? companyName,
    String? branchName,
    String? warehouseName,
  }) = _EquipmentResponse;

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