The answer to the following question is probably well known or the question itself is well known not to have a reasonable answer. In the latter case could you please let me know what the "right" question may be (rather then stating that the answer is 42;))

Is there a purely categorical procedure that takes the category of commutative rings as input and produces the category of schemes (over $\mathbf{Z}$) as output?

A possible place to start would be to consider a scheme $X$ as a functor from the category $CommRing$ of commutative rings to the category of sets: $A\mapsto Hom_{Sch}(Spec(A),X)$ where $A$ a commutative ring. If we instead of $Spec(A)$'s we consider all schemes, then we simply get the Yoneda embedding. But some questions arise.

Does this give a fully faithful functor from schemes to functors from commutative rings to sets? Or loosely speaking, do $Spec(A)$-valued points ($A$ a commutative ring) suffice to determine a scheme? (My guess is that the answer is yes and this is classical.)

Is there a way to characterize those functors that actually come from schemes? For example one can introduce a Grothendieck topology on $CommRing$ (or its opposite) and require that the functor should be a sheaf in that topology. But in that case, can one describe the topology without referring to the fact that the objects of $CommRing$ are commutative rings? (Here my guess is the first question is probably too complicated but there are some necessary conditions.)

Regardless whether the answer to 2. is positive or negative, is there a way to describe algebraic spaces or stacks as presheaves on $CommRing^{op}$ that satisfy some conditions?