class MessageToProfessional
  include ActiveModel::Validations
  include ActiveModel::Conversion
  extend ActiveModel::Naming

  attr_accessor :full_name, :user_phone, :message, :user_email, :subject, :professional

  validates :full_name,
            :length => {:in => 8..150}

  validates :user_email,
            :format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :multiline => true }

  validates :user_phone,
            :format => { :with => /\(?\d{2}\)?\d{5}-?\d{3}\d?/i, :multiline => true }


  validates :message,
            :length => {:in => 50..1000}

  def initialize(attributes = {})
    attributes.each do |name, value|
      send("#{name}=", value)
    end
  end

  def persisted?
    false
  end
end
