defmodule Outlook.InternalTree.Basic do

  alias Outlook.InternalTree.InternalNode
  alias Outlook.InternalTree.TranslationUnit

  def clean_eph([%TranslationUnit{} = node | rest]) do
    [ %TranslationUnit{node | eph: %{}} | clean_eph(rest) ]
  end

  def clean_eph([%InternalNode{type: :element} = node | rest]) do
    [ %InternalNode{node |
        eph: %{},
        content: clean_eph(node.content)}
      | clean_eph(rest) ]
  end

  def clean_eph([%{type: _} = node | rest]) do
    [ %InternalNode{node | eph: %{}} | clean_eph(rest) ]
  end

  def clean_eph([]), do: []
end
