mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
77 lines
1.8 KiB
Dart
77 lines
1.8 KiB
Dart
import 'package:equatable/equatable.dart';
|
|
import 'package:syncrow_web/pages/device_managment/ac/model/ac_model.dart';
|
|
|
|
abstract class AcsState extends Equatable {
|
|
final bool isTimerActive;
|
|
|
|
const AcsState({this.isTimerActive = false});
|
|
@override
|
|
List<Object> get props => [];
|
|
}
|
|
|
|
class AcsInitialState extends AcsState {}
|
|
|
|
class AcsLoadingState extends AcsState {}
|
|
|
|
class ACStatusLoaded extends AcsState {
|
|
final AcStatusModel status;
|
|
final DateTime timestamp;
|
|
final int scheduledHours;
|
|
final int scheduledMinutes;
|
|
final bool isTimerActive;
|
|
|
|
ACStatusLoaded({
|
|
required this.status,
|
|
this.scheduledHours = 0,
|
|
this.scheduledMinutes = 0,
|
|
this.isTimerActive = false,
|
|
}) : timestamp = DateTime.now();
|
|
ACStatusLoaded copyWith({
|
|
AcStatusModel? status,
|
|
int? scheduledHours,
|
|
int? scheduledMinutes,
|
|
bool? isTimerActive,
|
|
int? remainingTime,
|
|
}) {
|
|
return ACStatusLoaded(
|
|
status: status ?? this.status,
|
|
scheduledHours: scheduledHours ?? this.scheduledHours,
|
|
scheduledMinutes: scheduledMinutes ?? this.scheduledMinutes,
|
|
isTimerActive: isTimerActive ?? this.isTimerActive,
|
|
);
|
|
}
|
|
|
|
@override
|
|
List<Object> get props => [status, timestamp];
|
|
}
|
|
|
|
class AcBatchStatusLoaded extends AcsState {
|
|
final AcStatusModel status;
|
|
final DateTime timestamp;
|
|
|
|
AcBatchStatusLoaded(this.status) : timestamp = DateTime.now();
|
|
|
|
@override
|
|
List<Object> get props => [status, timestamp];
|
|
}
|
|
|
|
class AcsFailedState extends AcsState {
|
|
final String error;
|
|
|
|
const AcsFailedState({required this.error});
|
|
|
|
@override
|
|
List<Object> get props => [error];
|
|
}
|
|
|
|
class TimerRunInProgress extends AcsState {
|
|
final int remainingTime;
|
|
|
|
const TimerRunInProgress(this.remainingTime);
|
|
|
|
@override
|
|
List<Object> get props => [remainingTime];
|
|
}
|
|
|
|
|