Longitudinal Mediation with only two time points

I am doing longitudinal mediation analysis with brms. Previous suggestions include the use of splines and Gaussian process. However, because I’m only considering two time points (baseline and end-of-treatment), I am not sure the gp would be the best approach.

Both the independent variable (X) and the Mediatior (M) are time-varying. Could this be something like this:

a<-bf(M ~ time*X + (1|ID))

b<-bf(Y ~ time*M + time*X + (1|ID))

mediation<-brm(a + b + set_rescor(FALSE), data = data)

Many Thanks!