langcode: en
status: true
dependencies:
  config:
    - media.type.remote_video
  module:
    - eca_base
    - eca_config
    - eca_content
    - eca_user
    - modeler_api
third_party_settings:
  modeler_api:
    modeler_id: bpmn_io
    label: 'Enable consent management for remote video'
id: remote_video_consent
weight: 0
template: null
events:
  content_entity__insert_video:
    plugin: 'content_entity:insert'
    label: 'Insert remote video'
    configuration:
      type: 'media remote_video'
    successors:
      -
        id: eca_token_set_value_1
        condition: ''
  config__save_config:
    plugin: 'config:save'
    label: 'Save config'
    configuration:
      config_name: ''
      sync_mode: ''
      write_mode: ''
    successors:
      -
        id: eca_void_and_condition_1
        condition: eca_scalar_is_2
      -
        id: eca_void_and_condition_1
        condition: eca_scalar_is_1
conditions:
  eca_scalar_is_2:
    plugin: eca_scalar
    label: 'youtube?'
    configuration:
      negate: false
      left: '[config_name]'
      right: klaro.klaro_app.youtube
      operator: equal
      type: value
      case: false
  eca_scalar_is_1:
    plugin: eca_scalar
    label: 'vimeo?'
    configuration:
      negate: false
      left: '[config_name]'
      right: klaro.klaro_app.vimeo
      operator: equal
      type: value
      case: false
  eca_scalar_vimeo_1:
    plugin: eca_scalar
    label: 'vimeo?'
    configuration:
      negate: false
      left: '[media:field_media_oembed_video]'
      right: vimeo.com
      operator: contains
      type: value
      case: false
  eca_scalar_disabled:
    plugin: eca_scalar
    label: 'active?'
    configuration:
      negate: true
      left: '[status]'
      right: '1'
      operator: equal
      type: value
      case: false
  eca_scalar_1:
    plugin: eca_scalar
    label: 'not active?'
    configuration:
      negate: true
      left: '[config:status]'
      right: '1'
      operator: equal
      type: value
      case: false
  eca_scalar_enabled:
    plugin: eca_scalar
    label: 'was active?'
    configuration:
      negate: false
      left: '[config_original:status]'
      right: '1'
      operator: equal
      type: value
      case: false
gateways: {  }
actions:
  eca_token_set_value_1:
    label: 'Set default provider to YouTube'
    plugin: eca_token_set_value
    configuration:
      token_name: provider
      token_value: youtube
      use_yaml: false
      validate_yaml: false
    successors:
      -
        id: eca_token_set_value_provider_1
        condition: eca_scalar_vimeo_1
      -
        id: eca_switch_account_1
        condition: ''
  eca_token_set_value_provider_1:
    label: 'Set provider to Vimeo'
    plugin: eca_token_set_value
    configuration:
      token_name: provider
      token_value: vimeo
      use_yaml: false
      validate_yaml: false
    successors: {  }
  eca_config_read_1:
    label: 'Read current setting'
    plugin: eca_config_read
    configuration:
      token_name: status
      include_overridden: true
      config_name: 'klaro.klaro_app.[provider]'
      config_key: status
    successors:
      -
        id: eca_config_write_1
        condition: eca_scalar_disabled
  eca_config_write_1:
    label: 'Enable provider'
    plugin: eca_config_write
    configuration:
      config_value: '1'
      use_yaml: false
      validate_yaml: false
      save_config: true
      config_name: 'klaro.klaro_app.[provider]'
      config_key: status
    successors: {  }
  eca_switch_account_1:
    label: 'Switch user account'
    plugin: eca_switch_account
    configuration:
      user_id: '1'
    successors:
      -
        id: eca_config_read_1
        condition: ''
  eca_void_and_condition_1:
    label: AND
    plugin: eca_void_and_condition
    configuration: {  }
    successors:
      -
        id: eca_void_and_condition_2
        condition: eca_scalar_1
  eca_void_and_condition_2:
    label: AND
    plugin: eca_void_and_condition
    configuration: {  }
    successors:
      -
        id: eca_switch_account__1
        condition: eca_scalar_enabled
  eca_config_write_provider:
    label: 'Re-enable provider'
    plugin: eca_config_write
    configuration:
      config_value: '1'
      use_yaml: false
      validate_yaml: false
      save_config: true
      config_name: '[config_name]'
      config_key: status
    successors: {  }
  eca_switch_account__1:
    label: 'Switch user'
    plugin: eca_switch_account
    configuration:
      user_id: '1'
    successors:
      -
        id: eca_token_load_entity_0rno7mm_1
        condition: ''
  eca_token_load_entity_0rno7mm_1:
    label: 'Load a remote video'
    plugin: eca_token_load_entity
    configuration:
      token_name: video
      from: properties
      entity_type: media
      entity_id: ''
      revision_id: ''
      properties: 'bundle: remote_video'
      langcode: _interface
      latest_revision: false
      unchanged: false
      object: ''
    successors:
      -
        id: eca_config_write_provider
        condition: ''
