part of 'xiao_connector_cubit.dart';

enum XiaoConnectorStatus {
  initial,
  loading,
  connected,
  capturing,
  failure,
}

extension XiaoConnectorStatusX on XiaoConnectorStatus {
  bool get isInitial => this == XiaoConnectorStatus.initial;
  bool get isLoading => this == XiaoConnectorStatus.loading;
  bool get isConnected => this == XiaoConnectorStatus.connected;
  bool get isCapturing => this == XiaoConnectorStatus.capturing;
  bool get isFailure => this == XiaoConnectorStatus.failure;
}

final class XiaoConnectorState extends Equatable {
  const XiaoConnectorState({
    this.status = XiaoConnectorStatus.initial,
    this.lastCapturedPoint,
  });

  final XiaoConnectorStatus status;
  final CapturePoint? lastCapturedPoint;

  XiaoConnectorState copyWith({
    XiaoConnectorStatus? status,
    CapturePoint? lastCapturedPoint,
  }) {
    return XiaoConnectorState(
      status: status ?? this.status,
      lastCapturedPoint: lastCapturedPoint ?? this.lastCapturedPoint,
    );
  }

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