import 'package:equatable/equatable.dart';
import 'package:syncrow_web/pages/device_managment/device_setting/settings_model/device_info_model.dart';
import 'package:syncrow_web/pages/device_managment/device_setting/settings_model/sub_space_model.dart';

abstract class DeviceSettingsState extends Equatable {
  const DeviceSettingsState({this.deviceInfo});

  final DeviceInfoModel? deviceInfo;

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

class DeviceSettingsInitial extends DeviceSettingsState {
  final String deviceName;
  final String deviceId;
  final bool isEditingName;
  final String editingNameValue;

  const DeviceSettingsInitial({
    this.deviceName = '',
    this.deviceId = '',
    this.isEditingName = false,
    this.editingNameValue = '',
    super.deviceInfo,
  });

  DeviceSettingsInitial copyWith({
    String? deviceName,
    String? deviceId,
    bool? isEditingName,
    String? editingNameValue,
  }) =>
      DeviceSettingsInitial(
        deviceName: deviceName ?? this.deviceName,
        deviceId: deviceId ?? this.deviceId,
        isEditingName: isEditingName ?? this.isEditingName,
        editingNameValue: editingNameValue ?? this.editingNameValue,
      );

  @override
  List<Object?> get props =>
      [deviceName, deviceId, isEditingName, editingNameValue];
}

class DeviceSettingsLoading extends DeviceSettingsState {}

class DeviceSettingsUpdate extends DeviceSettingsState {
  final String? deviceName;
  final List<SubSpaceModel> roomsList;

  const DeviceSettingsUpdate({
    this.deviceName,
    super.deviceInfo,
    this.roomsList = const [],
  });

  @override
  List<Object?> get props => [deviceName, deviceInfo, roomsList];
}

class DeviceSettingsError extends DeviceSettingsState {
  final String message;

  const DeviceSettingsError({required this.message});
  @override
  List<Object?> get props => [message];
}

class DeviceSettingsFetchRooms extends DeviceSettingsState {
  final List<SubSpaceModel> roomsList;

  const DeviceSettingsFetchRooms({required this.roomsList});

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

class DeviceSettingsSaveSelectionSuccess extends DeviceSettingsState {}

class ChangeNameState extends DeviceSettingsState {}
