part of 'scan_bloc.dart';

abstract class ScanState extends Equatable {
  const ScanState();

  @override
  List<Object?> get props => [];
}

class ScanInitial extends ScanState {}

class ScanReady extends ScanState {
  final Tour tour;

  const ScanReady({required this.tour});

  @override
  List<Object?> get props => [tour];
}

class ScanProcessing extends ScanState {
  final String barcode;

  const ScanProcessing({required this.barcode});

  @override
  List<Object?> get props => [barcode];
}

class ScanObjectDetected extends ScanState {
  final LogisticObject object;
  final String suggestedState;
  final Tour? tour;
  final String? originBarcode;

  const ScanObjectDetected({
    required this.object,
    required this.suggestedState,
    this.tour,
    this.originBarcode,
  });

  @override
  List<Object?> get props => [object, suggestedState, tour, originBarcode];
}

// Special state for Fehlkassette (error cassette) detection
class ScanFehlKassetteDetected extends ScanState {
  final LogisticObject object;
  final String suggestedState;
  final Tour? tour;

  const ScanFehlKassetteDetected({
    required this.object,
    required this.suggestedState,
    this.tour,
  });

  @override
  List<Object?> get props => [object, suggestedState, tour];
}

// Special state for container object detection (VS state machine)
class ScanContainerObjectDetected extends ScanState {
  final LogisticObject object;
  final String suggestedState;
  final Tour? tour;
  final String containerId;
  final String containerType;

  const ScanContainerObjectDetected({
    required this.object,
    required this.suggestedState,
    this.tour,
    required this.containerId,
    required this.containerType,
  });

  @override
  List<Object?> get props => [object, suggestedState, tour, containerId, containerType];
}

// Special state for container detection
class ScanContainerDetected extends ScanState {
  final LogisticObject object;
  final String suggestedState;
  final Tour? tour;
  final String containerId;
  final String containerType;

  const ScanContainerDetected({
    required this.object,
    required this.suggestedState,
    this.tour,
    required this.containerId,
    required this.containerType,
  });

  @override
  List<Object?> get props => [object, suggestedState, tour, containerId, containerType];
}

// Special state for container close detection (vehVs state machine)
class ScanContainerCloseDetected extends ScanState {
  final LogisticObject object;
  final String suggestedState;
  final String targetStateForObjects;
  final Tour? tour;
  final String containerType;

  const ScanContainerCloseDetected({
    required this.object,
    required this.suggestedState,
    required this.targetStateForObjects,
    this.tour,
    required this.containerType,
  });

  @override
  List<Object?> get props => [object, suggestedState, targetStateForObjects, tour, containerType];
}

class ScanUnknownObject extends ScanState {
  final String barcode;
  final String prefix;
  final Tour? tour;

  const ScanUnknownObject({
    required this.barcode,
    required this.prefix,
    this.tour,
  });

  @override
  List<Object?> get props => [barcode, prefix, tour];
}

class ScanPageDetected extends ScanState {
  final String pageId;
  final String label;
  final Tour tour;

  const ScanPageDetected({
    required this.pageId,
    required this.label,
    required this.tour,
  });

  @override
  List<Object?> get props => [pageId, label, tour];
}

class ScanObjectUpdated extends ScanState {
  final LogisticObject object;
  final String previousState;
  final String newState;
  final Tour? tour;

  const ScanObjectUpdated({
    required this.object,
    required this.previousState,
    required this.newState,
    this.tour,
  });

  @override
  List<Object?> get props => [object, previousState, newState, tour];
}

class ScanObjectCreated extends ScanState {
  final String barcode;

  const ScanObjectCreated({required this.barcode});

  @override
  List<Object?> get props => [barcode];
}

class ScanError extends ScanState {
  final String message;

  const ScanError({required this.message});

  @override
  List<Object?> get props => [message];
}

class ScanValidationError extends ScanState {
  final String message;

  const ScanValidationError({required this.message});

  @override
  List<Object?> get props => [message];
}
