class WcoEmail::EmailFilterCondition

def apply leadset:, message:

def apply leadset:, message:
  cond = self
  reason = nil
  case cond.field
  when WcoEmail::FIELD_LEADSET
    if cond.operator == WcoEmail::OPERATOR_NOT_HAS_TAG
      this_tag = Wco::Tag.find cond.value
      if leadset.tags.include?( this_tag )
        ;
      else
        reason = "{email_skip_filter ? 'skip_' : ''}condition leadset not-has-tag #{this_tag} NOT met"
      end
    end
  when WcoEmail::FIELD_TO
    if message.to == cond.value
      reason = "{email_skip_filter ? 'skip_' : ''}condition to = #{cond.value}"
    end
  end
  return reason
end

def to_s

def to_s
  "<EFC #{field} #{operator} #{value} />"
end

def to_s_full indent: 0

def to_s_full indent: 0
  _value = value
  if [ ::WcoEmail::OPERATOR_HAS_TAG, ::WcoEmail::OPERATOR_NOT_HAS_TAG ].include?( operator )
    _value = Wco::Tag.find( value )
  end
  "#{" " * indent }<EF#{email_skip_filter ? 'Skip' : ''}Condition #{field} #{operator} `#{_value}` />\n"
end