id: d7_user_profile_customer
label: D7 User Customer Profile
migration_group: d7_materio
audit: true
migration_tags:
  - Drupal 7
  - Content
  - Materio

source:
  plugin: d7_user_profile_customer
  batch_size: 1000
  
destination:
  plugin: entity:profile

process:
  # id: pid
  # label: label

  type: 
    plugin: default_value
    default_value: customer
    # -
    #   plugin: skip_on_value
    #   equals: true
    #   source: type
    #   method: row
    #   value:
    #     - contact_operationnel
    # -  
    #   plugin: static_map
    #   source: type
    #   map:
    #     adherent: customer

  uid:
    plugin: migration_lookup
    migration: d7_users
    source: uid

  phone: billing_phone


  
  address/country_code: billing_country
  address/administrative_area: billing_zone
  address/locality: billing_city
  # address/dependent_locality: dependent_locality
  address/postal_code: billing_postal_code
  # address/sorting_code:
  address/address_line1: billing_street1
  address/address_line2: billing_street2
  address/organization: billing_company
  address/given_name: billing_first_name
  # address/additional_name:
  address/family_name: billing_last_name

  # address:
  #     plugin: iterator
  #     source: field_adresse
  #     process:
  #       # langcode:
  #       country_code: country
  #       administrative_area: administrative_area
  #       locality: locality
  #       dependent_locality: dependent_locality
  #       postal_code: postal_code
  #       # sorting_code:
  #       address_line1: thoroughfare
  #       # address_line2:
  #       organization: organisation_name
  #       given_name: first_name
  #       # additional_name:
  #       family_name: last_name

  #       # SOURCES
  #       # sub_administrative_area
  #       # premise
  #       # sub_premise
  #       # name_line
  #       # data

  # body:
  #     plugin: iterator
  #     source: field_description
  #     process:
  #       value: value
  #       format:
  #         plugin: default_value
  #         default_value: wysiwyg
  tax_number: 
    plugin: iterator
    source: field_vat_number_intra_ce
    process:
      value: value
      type:
        plugin: default_value
        default_value: EU

migration_dependencies:
  required:
    - d7_users

dependencies:
  enforced:
    module:
      - migrate_plus
      - migrate_tools
      - profile
