class CommandPolicy
  attr_reader :user, :model

  def initialize(user, model)
    @user = user || User.new
    @command = model
  end

  class Scope
    def initialize(user, scope)
      @user  = user
      @scope = scope
    end

    def resolve
      if user.admin?
        scope.all
      else
        scope.all
      end
    end

    private

    attr_reader :user, :scope
  end

  def run?
    @user.admin? || true
  end

  def index?
    true
  end

  def show?
    @user.admin?
  end

  def new?
    @user.admin?
  end

  def create?
    @user.admin?
  end

  def edit?
    @user.admin?
  end

  def update?
    @user.admin?
  end

  def destroy?
    @user.admin?
  end
end
