Peace be upon you brother
You said you are just a beginner so please let's learn together
The verb to plan should be used in the present continuous because it takes a long time to plan something
Well, let's discuss the rest of the sentence
Here the question that we can can ask is: what are you planning
And the answer is: to go to Spain
I am planning something, and this thing is: to go to Spain
So it is a Direct Object
And to be more precise: it is a to infinitive clause, and it's function is Direct Object
If you have another explanation please discuss it with us
Allah bless you