class WcoEmail::EmailFilterAction

def check_value

def check_value
  case kind
  when KIND_AUTORESPOND
    existing = WcoEmail::EmailTemplate.where({ id: value }).first
    if !existing
      errors.add( :base, 'missing EmailTemplate id when creating an EmailFilterAction' )
      throw :abort
    end
  end
end

def to_s

def to_s
  "<EFA #{kind} #{value} />\n"
end

def to_s_full indent: 0

def to_s_full indent: 0
  _value = value
  if [ KIND_ADD_TAG, KIND_REMOVE_TAG ].include?( kind )
    _value = Wco::Tag.find( value )
  end
  if [ KIND_AUTORESPOND ].include?( kind )
    _value = WcoEmail::EmailTemplate.find( value )
  end
  "#{" " * indent }<EFAction #{kind} `#{_value}` />\n"
end