id: d7_users
label: User accounts
migration_group: d7_materio
audit: true
migration_tags:
  - Drupal 7
  - Content
  - Materio

source:
  plugin: d7_users
  batch_size: 1000

destination:
  plugin: entity:user

process:
  name: name
  pass: pass
  mail:
    -
      plugin: skip_on_value
      equals: true
      source: mail
      method: row
      value:
        - "dev@g-u-i.net"
        - "admin@g-u-i.net"
    -
      plugin: default_value
      source: mail
      default_value: null

  created: created
  access: access
  login: login
  status: status
  timezone: timezone
  langcode:
    plugin: user_langcode
    source: entity_language
    fallback_to_site_default: false
  preferred_langcode:
    plugin: user_langcode
    source: language
    fallback_to_site_default: true
  preferred_admin_langcode:
    plugin: user_langcode
    source: language
    fallback_to_site_default: true
  init: init
  roles:
    plugin: static_map
    source: roles
    default_value: 2
    map:
      1: "anonymous"
      2: "authenticated"
      3: "admin"
      4: "root"
      5: "contact_company"
      6: "adherent"
      7: "free_user"
      8: "premium"
      9: "unverified"
      10: "student"
      11: "alpha_testeur"
      12: "translator"
      13: "admin_showroom"

  field_company:
    plugin: migration_lookup
    migration: d7_taxonomy_term_company
    source: field_company
    no_stub: true
  # field_company:
  #   -
  #     plugin: sub_process
  #     source: field_company
  #     process:
  #       target_id:
  #         plugin: migration_lookup
  #         migration: d7_taxonomy_term_company
  #         source: tid
  #         no_stub: true
  # field_company:
  #   plugin: default_value
  #   default_value: 2673

  field_showroom:
    plugin: migration_lookup
    migration: d7_taxonomy_term_showroom
    no_stub: true
    source: field_showroom

  field_memo: field_memo

  # user_picture:
  #   -
  #     plugin: default_value
  #     source: picture
  #     default_value: null
  #   -
  #     plugin: migration_lookup
  #     migration: d7_file
  #     no_stub: true

migration_dependencies:
  required:
    - d7_allpublicfiles
    - d7_taxonomy_term_showroom
    - d7_taxonomy_term_company
  # optional:
  #   - d7_field_instance
  #   - d7_file
  #   - language
  #   - default_language
  #   - user_picture_field_instance
  #   - user_picture_entity_display
  #   - user_picture_entity_form_display
