# == Schema Information
#
# Table name: reports
#
#  id                  :integer          not null, primary key
#  title               :string(255)
#  from_time           :datetime
#  to_time             :datetime
#  created_at          :datetime
#  updated_at          :datetime
#  location_network_id :integer
#  flag                :integer
#  path                :string(255)
#  scheduled_report_id :integer
#  is_super_admin      :boolean          default(FALSE)
#  user_id             :integer
#

class Report < ActiveRecord::Base
  resourcify
  include PublicActivity::Model

  tracked owner: ->(controller, model) { controller && controller.tracked_current_user },params: { :attributes=> proc {|controller, model_instance| {"report(#{model_instance.from_time.strftime('%b-%d-%y')} to #{model_instance.to_time.strftime('%b-%d-%y')})" => model_instance.changes}}},organisation_id: ->(controller, model) { controller && controller.tracked_current_user.organisation_id },:location_network_id => proc {|controller, model_instance| model_instance.location_network_id}

  tracked assumed_by: proc {|controller, model| controller.user_assumed_by if controller}

  belongs_to :location_network
  belongs_to :scheduled_report

end
