Dunlop::Ability::BaseRole = Struct.new(:ability, :type, :class_name) do
  def class_role?
    type == 'class'
  end

  def app_role?
    %w[app adapter].include? type
  end

  def target_class
    @target_class ||= class_name.constantize
  end

  def user_role?
    false
  end

  def admin_role?
    false
  end

  def ability
    self[:ability].to_sym
  end
end
