import 'package:freezed_annotation/freezed_annotation.dart';

part 'equipment_history_dto.freezed.dart';
part 'equipment_history_dto.g.dart';

@freezed
class EquipmentHistoryDto with _$EquipmentHistoryDto {
  const factory EquipmentHistoryDto({
    required int id,
    required int equipmentId,
    required String transactionType,
    required int quantity,
    required DateTime transactionDate,
    String? remarks,
    int? createdBy,
    int? userId,
    required DateTime createdAt,
    // 추가 정보
    String? userName,
    String? performedBy,
  }) = _EquipmentHistoryDto;

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

@freezed
class CreateHistoryRequest with _$CreateHistoryRequest {
  const factory CreateHistoryRequest({
    required String transactionType,
    required int quantity,
    DateTime? transactionDate,
    String? remarks,
    int? userId,
  }) = _CreateHistoryRequest;

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

// 트랜잭션 타입 상수
class TransactionType {
  static const String checkIn = 'I';  // 입고
  static const String checkOut = 'O'; // 출고
  static const String maintenance = 'maintenance';
  static const String repair = 'repair';
  static const String inspection = 'inspection';
  static const String transfer = 'transfer';
}