Wake when goal is reached

I often don’t have any appointments the next day, but I set an alarm clock so I don’t sleep too much. Sometimes, however, it takes me a long time to fall asleep or I am awake a lot. Then I get annoyed that the alarm clock didn’t wake me up later. I would like a feature that wakes me up as soon as a sleep score or a duration of REM, light sleep, deep sleep or the entire sleep is reached. Optionally, a latest wake-up time could be specified. It is already possible to set the alarm so that I am not woken up before my sleep goal (8 hours in my case), but this does not take into account how I sleep. I know that you have not wanted to implement dynamic alarms so far, and I am not sure whether the necessary statistics are only available retrospectively. But I have been thinking about this feature for years and would be delighted if it could be implemented. Thank you very much in advance!