Learning how to write a Zero Inflated Poisson model with stan?

Could you show me how to implement this? I based what I did on this post. This is how i’m reading my code:

  1. Observation n will be zero with probability theta[n]: zero=bernoulli_rng(theta[n]);
  2. If observation n is not zero, then it will draw a value from the Poisson: y_sim[n]=(1-zero)*poisson_log_rng(lambda_log[n])