import 'package:freezed_annotation/freezed_annotation.dart';

part 'equipment_list_dto.freezed.dart';
part 'equipment_list_dto.g.dart';

@freezed
class EquipmentListDto with _$EquipmentListDto {
  const factory EquipmentListDto({
    required int id,
    @JsonKey(name: 'equipment_number') required String equipmentNumber,
    required String manufacturer,
    @JsonKey(name: 'model_name') String? modelName,
    @JsonKey(name: 'serial_number') String? serialNumber,
    required String status,
    @JsonKey(name: 'current_company_id') int? currentCompanyId,
    @JsonKey(name: 'current_branch_id') int? currentBranchId,
    @JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
    @JsonKey(name: 'created_at') required DateTime createdAt,
    // 추가 필드 (조인된 데이터)
    @JsonKey(name: 'company_name') String? companyName,
    @JsonKey(name: 'branch_name') String? branchName,
    @JsonKey(name: 'warehouse_name') String? warehouseName,
  }) = _EquipmentListDto;

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