import 'dart:convert'; class SceneDetailsModel { final String id; final String name; final String status; final String type; final List actions; SceneDetailsModel({ required this.id, required this.name, required this.status, required this.type, required this.actions, }); factory SceneDetailsModel.fromRawJson(String str) => SceneDetailsModel.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); factory SceneDetailsModel.fromJson(Map json) => SceneDetailsModel( id: json["id"], name: json["name"], status: json["status"], type: json["type"], actions: List.from(json["actions"].map((x) => Action.fromJson(x))), ); Map toJson() => { "id": id, "name": name, "status": status, "type": type, "actions": List.from(actions.map((x) => x.toJson())), }; } class Action { final String actionExecutor; final String entityId; final ExecutorProperty executorProperty; Action({ required this.actionExecutor, required this.entityId, required this.executorProperty, }); factory Action.fromRawJson(String str) => Action.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); factory Action.fromJson(Map json) => Action( actionExecutor: json["actionExecutor"], entityId: json["entityId"], executorProperty: ExecutorProperty.fromJson(json["executorProperty"]), ); Map toJson() => { "actionExecutor": actionExecutor, "entityId": entityId, "executorProperty": executorProperty.toJson(), }; } class ExecutorProperty { final String? functionCode; final dynamic functionValue; final dynamic delaySeconds; ExecutorProperty({ this.functionCode, this.functionValue, this.delaySeconds, }); factory ExecutorProperty.fromJson(Map json) => ExecutorProperty( functionCode: json["functionCode"] ?? '', functionValue: json["functionValue"] ?? '', delaySeconds: json["delaySeconds"] ?? 0, ); Map toJson() => { "functionCode": functionCode, "functionValue": functionValue, "delaySeconds": delaySeconds, }; }