UK Employee - work remotely from Portugal - NHR opportunities?


With everything going on in the world at the moment and no return to the office on the horizon (or ever…?), i was toying with the idea of potentially moving full-time to Portugal (before Brexit) and “working remotely” and continuing in my job as an employee for my UK Employer (mid-sized tech company, HQ-ed in UK).

The following are probably basic questions, but I’m struggling to find answers and wondered if anyone could help:

- would I be taxed by the UK tax authorities or the Portuguese tax authorities?
I would be working remotely for UK company as an employee (not a contractor), but living full-time in Portugal - so which country would charge income tax / social security? I’m not sure which has higher tax/social security levels - so not sure if either is better/worse!

- would NHR be available or offer any advantages? I read something about Portugal’s NHR only charges a flat 20% income tax (i pay 40% tax in UK) - I’m a software engineer so should fall into one of the NHR professional buckets. How would that work? Would I tell the UK tax authorities that I’m a Portuguese tax resident (and register in Portugal etc), my employer would pay me my “gross” salary and Portugal would then tax me at 20%?

This might all be a pipe dream, but thought i’d ask to see if anyone could give me some direction and then i’ll dig into it more.

Thanks in advance!