/**
 * The final genearted blueprint node file.
 */
class BlueprintNode2 extends BaseNode {
  static config = {
    // Auto generate from @BP_INPUT
    inputs: [
      {
        name: 'onStartMonitor',
        type: 'exec',
      },
      {
        name: 'monitorTargetCondition',
        type: 'string',
      },
    ],
    // Auto generate from @BP_OUTPUT
    outputs: [
      {
        name: 'processAction',
        type: 'callback',
      },
      {
        name: 'moveDetection',
        type: 'boolean',
      },
      {
        name: 'historyRecord',
        type: 'object',
      },
      {
        name: 'realtimeVideo',
        type: 'object',
      },
    ],
  }

  // #region Input-Functions

  onStartMonitor(data, inputs, outputs) {
    let monitorTargetCondition = inputs['monitorTargetCondition']

    this.monitorTarget = this.object.query(monitorTargetCondition)[0]
    if (this.monitorTarget) {
      this.monitorTarget.style.color = 'red'
    }
  }

  // #endregion

  // #region BaseNode Overrides

  onStop() {
    if (this.monitorTarget) {
      this.monitorTarget.style.color = null
    }
  }

  // Auto generate onExecute logic code
  onExecute(data, inputs, outputs) {
    let curExecName = this.curExecName

    let func = this[curExecName]
    if (Utils.isFunction(func)) {
      func(data, inputs, outputs)
    }
  }

  // #endregion
}

export { BlueprintNode2 }
