You can set a hibernation time for your computer in Windows 11, though you might need to enable the feature first.
I'm assuming you've done the requisite googling so i didn't bother. I had a look at what events i could find in .net, since i had the help open, and services are notified of all power event changes.
Some results have been hidden because they may be inaccessible to you
Show inaccessible results