I want to give the wapon style version as reward when a PC character fully upgrades the martial version. The problem is, I couldnt find any script/function that returrns the mastery level of a style, and to capture stlye master upgrading event.

It's been a while since I did any JE modding so I'm not 100% sure of this, but I believe you can use the GetCombatStyleLevel() function to check what mastery level someone has of a particular style, and GetHasStyle() to check if they know the style at all, and ApplyStyleAdvanceLine() to make someone learn a style or upgrade it (refers to the StyleAdvance.2da file with the last parameter).

As far as I am aware there is no event triggering when a player upgrades a style, so you'd likely have to check that from some other script instead. If you can find no suitable spot you could probably add it to the heartbeat script used by the player party member AI since those should trigger once per round all the time. (The easiest way would likely be to rename the old heartbeat script NCS file and give your new script its name and then fire the old renamed script at the end of yours with the ExecuteScript() function.)