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

part 'equipment_request.freezed.dart';
part 'equipment_request.g.dart';

@freezed
class CreateEquipmentRequest with _$CreateEquipmentRequest {
  const factory CreateEquipmentRequest({
    required String equipmentNumber,
    String? category1,
    String? category2,
    String? category3,
    required String manufacturer,
    String? modelName,
    String? serialNumber,
    DateTime? purchaseDate,
    double? purchasePrice,
    String? remark,
  }) = _CreateEquipmentRequest;

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

@freezed
class UpdateEquipmentRequest with _$UpdateEquipmentRequest {
  const factory UpdateEquipmentRequest({
    String? category1,
    String? category2,
    String? category3,
    String? manufacturer,
    String? modelName,
    String? serialNumber,
    String? barcode,
    DateTime? purchaseDate,
    double? purchasePrice,
    @EquipmentStatusJsonConverter() String? status,
    int? currentCompanyId,
    int? currentBranchId,
    int? warehouseLocationId,
    DateTime? lastInspectionDate,
    DateTime? nextInspectionDate,
    String? remark,
  }) = _UpdateEquipmentRequest;

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