Finding $x_1+x_2$, where the $x_i$, and $y$ and $z$, are positive integers satisfying $x^2+y^2+z^2=2(xy+1)$ and $x+y+z=2022$ 
Let $x$, $y$, and $z$ be positive integers satisfying
$$(x)^2+(y)^2+(z)^2=2(xy+1) \quad\text{and}\quad x+y+z=2022$$
If $x_1$ and $x_2$ are 2 distinct solutions for $x$, what is the value of $x_1+x_2$?

Attempted to express $(x)^2+(y)^2+(z)^2=2(xy+1)$ as $(x-y)^2+(z)^2=2$, then I'm stuck.
Kindly advise! Thanks!

Considering achile hui comment we have:
$z=1$ and $(x-y)^2=1$ and:
case 1):$\begin {cases}x-y=1\\x+y+1=2022\end{cases}$
which gives $x=1011$ and $y=1010$
case 2):$\begin {cases}x-y=-1\\x+y+1=2022\end{cases}$
which gives $x=1010$ and $y=1011$
