is prototype: true
terms:
  metadata: 
    category: object
    name: Unnamed object
    previews:
      - small:
          - file: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/No-Image-Placeholder.svg/64px-No-Image-Placeholder.svg.png"
            format: PNG
      - large:
          - file: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/65/No-Image-Placeholder.svg/512px-No-Image-Placeholder.svg.png"
            format: PNG
    tags: [ "object", "prototype" ]
  owner: null
  children: { }
  transformation: [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ]

clauses:
  transfer child:
    $if:
      condition:
        $is defined:
          $get:
            term:
              - "children"
              - $subject item: "child"
      is met then:
        $do:
          - $execute:
              clause: [ "add child" ]
              of pactum:
                $subject item: "to parent"
              subject to:
                $subject item: "child"
          - $delete:
              term:
                - "children"
                - $subject item: "child"
      else:
        $revert:
          error: "no such child"
  add child:
    $if:
      condition:
        $is defined:
          $get:
            term:
              - "children"
              - $subject
      is met then:
        $revert:
          error: "the child already exists"
      else:
        $set:
          term:
            - "children"
            - $subject
          to value: true
  get object:
    $get:
      term: [ ]
  transform:
    $set:
      term: [ "transformation" ]
      to value: $subject

