2022-02-17 20:35:36 +08:00
|
|
|
|
|
|
|
|
class Action():
|
2022-04-16 10:50:37 +08:00
|
|
|
def __init__(self, action_id, action):
|
|
|
|
|
self._id: str = action_id
|
|
|
|
|
self._type: str = action['type']
|
|
|
|
|
self._target: str = action['target']
|
|
|
|
|
self._condition : list[str] = action['condition']
|
|
|
|
|
# self._duration = action.get('duration', None)
|
|
|
|
|
# self._goto = action.get('goto', None)
|
|
|
|
|
# self._cycle = action.get('cycle', None)
|
2022-03-02 18:13:02 +08:00
|
|
|
|
2022-04-16 10:50:37 +08:00
|
|
|
@property
|
|
|
|
|
def id(self):
|
|
|
|
|
return self._id
|
|
|
|
|
|
2022-03-02 18:13:02 +08:00
|
|
|
@property
|
|
|
|
|
def type(self):
|
|
|
|
|
return self._type
|
2022-04-16 10:50:37 +08:00
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def target(self):
|
|
|
|
|
return self._target
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def condition(self):
|
|
|
|
|
return self._condition
|
2022-09-06 16:28:38 +08:00
|
|
|
|
|
|
|
|
def as_json(self):
|
|
|
|
|
return {
|
|
|
|
|
'id': self._id,
|
|
|
|
|
'type': self._type,
|
|
|
|
|
'target': self._target,
|
|
|
|
|
'condition': self._condition
|
|
|
|
|
}
|