
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
Find the values of the real number $x$ for which the complex number $z = \lg (x^{2}-2x-2)+(x^{2}+3x+2)i$ is:<br/>
$(1)$ When $z$ is a real number, find the value of $x$;<br/>
$(2)$ When $z$ is a purely imaginary number, find the value of $x$.

Present the answer in LaTex format: \boxed{Your answer}
user