We use the past perfect and the would have:
IF + condition in PAST PERFECT + result with WOULD HAVE + PARTICIPLE
To speak of events in the past, which had otherwise occurred, would have had other consequences. This is a hypothetical situation in the past. We are imagining what could have happened.
If I had had enough money, I would have bought you a house
-What would you have done if you had been in my shoes? /¿Qué hubieras hecho si te hubiera ocurrido a ti?
-Yesterday she played the lottery and she did not win. If she had won the lottery, she would have booked holidays in the Caribbean. /Ayer ella jugó a la lotería y no ganó. Si ella hubiera ganado la lotería, hubiera reservado unas vacaciones en el Caribe.
-If I had studied medicine he would have been a very good doctor./Si él hubiera estudiado medicina, hubiera sido un gran doctor.