langcode: en
status: true
dependencies:
  enforced:
    module:
      - farm_animal
      - farm_migrate
id: farm_migrate_asset_animal
label: 'Assets (Animals)'
migration_group: farm_migrate_asset
migration_tags:
  - 'Drupal 7'
  - 'farmOS 1.x'
class: Drupal\migrate\Plugin\Migration
field_plugin_method: null
cck_plugin_method: null
source:
  plugin: d7_animal_asset
  bundle: animal
destination:
  plugin: 'entity:asset'
process:
  # Hard-code the bundle.
  type:
    plugin: default_value
    default_value: animal
  # Maintain the asset ID.
  id:
    plugin: get
    source: id
  # Animal specific fields.
  animal_type:
    plugin: sub_process
    source: field_farm_animal_type
    process:
      target_id:
        plugin: migration_lookup
        migration: farm_migrate_taxonomy_animal_type
        source: tid
  birthdate:
    plugin: get
    source: field_farm_date
  nickname:
    plugin: get
    source: field_farm_animal_nicknames
  sex:
    plugin: get
    source: field_farm_animal_sex
  is_castrated:
    plugin: get
    source: field_farm_animal_castrated
  id_tag:
    plugin: sub_process
    source: animal_tags
    process:
      id:
        plugin: get
        source: id
      type:
        -
          plugin: skip_on_empty
          source: type
          method: process
        -
          plugin: static_map
          source: type
          map:
            Brand: brand
            Ear tag: ear_tag
            Tattoo: tattoo
            Leg band: leg_band
            Chip: eid
            Other: other
          default_value: other
      location:
        plugin: get
        source: location
migration_dependencies:
  required:
    - farm_migrate_taxonomy_animal_type
  optional: {  }
