class InformationOfficer < ActiveRecord::Base

  # Accessors
  attr_accessible :address, :email, :institution_id, :name, :phone, :latitude, :longitude, :designation_date

  # Non database attributtes
  attr_accessible :appointment_attachment

  # Paperclip
  has_attached_file :appointment_attachment

  # Paperclip
  has_attached_file :appointment_attachment

  # Associations
  belongs_to :institution

  # Validations
  validates :name, :email, :address, :presence => true

  # gmaps4rails
  acts_as_gmappable process_geocoding: false

  def has_coords?
    return false if latitude == 0 || longitude == 0
    true
  end

  def rescue_gmaps_coords
    [{ lat: 13.7131, lng: -89.2042 }].to_json
  end
end
