It's pretty complicated and case-by-case, and I'm no expert.
https://www.trade.gov/rules-origin-substantial-transformatio...