How to properly handle caps lock etc. in SDL keyboard implementation?

I thought to implement keyboard internally in SDL port, I should just create the basic keyboard events with scancodes. E.g. SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_CAPSLOCK);

However, caps lock doesn’t lock if I do it this way.

I though SDL internally would handle capslock? But it looks like I have to implement the lock myself?

Caps lock is a modifier. You can keep track of its status and change it using these functions:

But there’s also a scancode for it. Why is it both a key and a modifier? And which one should be set when the user presses it?