class FourSceneSwitchModel {
  final String switchName;
  final DateTime createdAt;
  final DateTime updatedAt;
  final String deviceUuid;
  final Scene scene;

  FourSceneSwitchModel({
    required this.switchName,
    required this.createdAt,
    required this.updatedAt,
    required this.deviceUuid,
    required this.scene,
  });

  factory FourSceneSwitchModel.fromJson(Map<String, dynamic> json) {
    return FourSceneSwitchModel(
      switchName: json['switchName'],
      createdAt: DateTime.parse(json['createdAt']),
      updatedAt: DateTime.parse(json['updatedAt']),
      deviceUuid: json['deviceUuid'],
      scene: Scene.fromJson(json['scene']),
    );
  }
}

class Scene {
  final String uuid;
  final String sceneTuyaId;
  final String name;
  final String status;
  final String icon;
  final String iconUuid;
  final bool showInHome;
  final String type;
  final List<Action> actions;

  Scene({
    required this.uuid,
    required this.sceneTuyaId,
    required this.name,
    required this.status,
    required this.icon,
    required this.iconUuid,
    required this.showInHome,
    required this.type,
    required this.actions,
  });

  factory Scene.fromJson(Map<String, dynamic> json) {
    return Scene(
      uuid: json['uuid'],
      sceneTuyaId: json['sceneTuyaId'],
      name: json['name'],
      status: json['status'],
      icon: json['icon'],
      iconUuid: json['iconUuid'],
      showInHome: json['showInHome'],
      type: json['type'],
      actions: (json['actions'] as List)
          .map((action) => Action.fromJson(action))
          .toList(),
    );
  }
}

class Action {
  final String actionExecutor;
  final String entityId;
  final Map<String, dynamic> executorProperty;

  Action({
    required this.actionExecutor,
    required this.entityId,
    required this.executorProperty,
  });

  factory Action.fromJson(Map<String, dynamic> json) {
    return Action(
      actionExecutor: json['actionExecutor'],
      entityId: json['entityId'],
      executorProperty: json['executorProperty'],
    );
  }
}
