35 lines
850 B
Python
35 lines
850 B
Python
|
|
class Action():
|
|
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)
|
|
|
|
@property
|
|
def id(self):
|
|
return self._id
|
|
|
|
@property
|
|
def type(self):
|
|
return self._type
|
|
|
|
@property
|
|
def target(self):
|
|
return self._target
|
|
|
|
@property
|
|
def condition(self):
|
|
return self._condition
|
|
|
|
def as_json(self):
|
|
return {
|
|
'id': self._id,
|
|
'type': self._type,
|
|
'target': self._target,
|
|
'condition': self._condition
|
|
}
|