I was wondering, when reading about Turkey being about to buy a S-400 defense system from Russia, how could they even consider that being an option. I get that global alliances went a bit obscured recently. And also understand that Turkey might have interests in increasing their relation with Russia and might consider this purchase for that reason, and also can understand why the USA absolutely don't like a NATO ally buying such a system from Russia.
But what I don't get, how could Turkey consider such a deal, and in the end this not mean drastic consequences for their NATO membership?
Could one do such a purchase and ensure the software running on such a defense system is not supervising and in given circumstances transmitting that data? If I was Russia, and a NATO member wanted to purchase a military system from me. I hella would make sure to add some hidden extra features to the system for them... Just in case, you know. And when I was USA or Turkey, I would pretty much expect Russia to do that, so from Turkeys point of view, I would not consider buying such a system from someone I might at somepoint have to use the system against (given that was one of the initial purposes the NATO was funded for), except I would intend to take sites to some degree with Russia in such a conflict anyways. So from the USA's view, I can understand the USA being concerned about it and not liking this at all. Especially, cause USA's politicans can think as far as I do as well and might wonder, if Turkey even intends to comply with the duty being promised by being in the NATO in case it would be required at some point.
So my question is, am I seeing this correct? Or are there additional measures being taken when buying weapon-/defense- systems from a country you might at some point have to use these systems against? I mean I don't get how one would trust such a system at all in such circumstances.