id: d7_taxonomy_term_company
label: Taxonomy terms Company
migration_group: d7_materio
audit: true
migration_tags:
  - Drupal 7
  - Content
  - Materio
deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver

source:
  plugin: d7_taxonomy_term_company
  bundle: company

destination:
  plugin: entity:taxonomy_term

process:
  # If you are using this file to build a custom migration consider removing
  # the tid field to allow incremental migrations.
  # tid: tid
  vid:
    plugin: default_value
    default_value: company
  name: name
  weight: weight
  # Only attempt to stub real (non-zero) parents.
  parent_id:
    -
      plugin: skip_on_empty
      method: process
      source: parent
    -
      plugin: migration_lookup
      migration: d7_taxonomy_term_company
  parent:
    plugin: default_value
    default_value: 0
    source: '@parent_id'
  changed: timestamp
  langcode:
    plugin: default_value
    default_value: 'und'
  field_migration:
    plugin: default_value
    default_value: 'migration_imported'

  # FROM TODE (linked tode node)
  field_website:
    plugin: iterator
    source: field_website
    process:
      uri: url
      title: title
      options: attributes
  field_memo: field_memo
  field_public_phone: public_phone
  field_public_email:
    plugin: iterator
    source: field_public_email
    process:
      value: email
  field_public_address:
    plugin: iterator
    source: field_public_address
    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

  field_note: field_note
  # field_departement: field_departement
  description:
    plugin: iterator
    source: body
    process:
      value: value
      format:
        plugin: default_value
        default_value: wysiwyg
  field_infos_from_company:
    plugin: iterator
    source: field_infos_from_company
    process:
      value: value
      format:
        plugin: default_value
        default_value: wysiwyg
  field_workflow:
      plugin: static_map
      source: workflow
      map:
        1: "workflow_creation"
        2: "workflow_hidden"
        3: "workflow_visible"
        4: "workflow_imported"
        5: "workflow_edited"
  field_attachments:
      plugin: iterator
      source: field_attachments
      process:
        target_id:
          plugin: migration_lookup
          migration: d7_allpublicfiles
          source: fid
          no_stub: true
        # there is no description field filled
        description: description

migration_dependencies:
  required:
    - d7_allpublicfiles
