Template light with set_level as a switch?

I have a desk light which is controlled via IR signals. 4 separate commands are sent via Broadlink RM3 Mini. On, off, brightness_high, brightness_low.

Looks like this:

  - platform: broadlink
    switches:
      bedroom_desklight:
        command_on: 'JgBgAAABJZYRORITERQRFBITEBQSFBITEBQSORA5EzcSORA5EjgROREUERQSOBE5ETkSExETEhQSNxI4ERQSFBITEDkTNxE5EQAFIgABJksSAAxaAAEmSxEADFsAASVMEQANBQAAAAAAAAAA='
        command_off: 'JgBgAAABJZYRORITERQRFBITEBQSFBITEBQSORA5EzcSORA5EjgROREUERQSOBE5ETkSExETEhQSNxI4ERQSFBITEDkTNxE5EQAFIgABJksSAAxaAAEmSxEADFsAASVMEQANBQAAAAAAAAAA='
      bedroom_desklight_brightness:
        command_on: 'JgCwAAABKJMUNhMTExITERMSFBISEhMSFBISNxQ2EzcTNxM3EzcTNxM2FDcSOBMSEzYUEhISExIUEhISExIUNhMSFDYTNxM3EwAFIAABKJQTNhMTExISEhMSFBISEhMSFBETNxQ2EzcUNhM3EzcTNxM2FDcSOBMSEzYUEhMRExIUEhISExIUNhMSFDYTNxQ2FAAFHwABKEoTAAxYAAEoShIADFkAAShKEwAMWQABJ0oUAA0FAAAAAAAAAAA='
        command_off: 'JgBgAAABJpUSORAUEhQSExAUERQTExAUERQRORE5ETkSOBE5ETkQOhEUEhMQFBIUEBUQFBIUEBUQOhA5EjkQORE5ETkRORE5EQAFIgABJkwSAAxZAAEnSxIADFkAASdLEgANBQAAAAAAAAAA='

And right now I have to use two separate switches to control this.
I want to be able to turn it on and off and control brightness via one template light.

This is what I got, but I cannot figure out how to send the brightness commands with the set_level:
light:

  - platform: template
    lights:
      bedroom_desklight:
        turn_on:
          service: switch.turn_on
          data:
            entity_id: switch.bedroom_desklight
        turn_off:
          service: switch.turn_off
          data:
            entity_id: switch.bedroom_desklight
        set_level:
          service: switch.bedroom_desklight_brightness

Anyone have an idea on how to do this?

Thank you!

  - platform: template
    lights:
      bedroom_desklight:
        turn_on:
          service: switch.turn_on
          data:
            entity_id: switch.bedroom_desklight
        turn_off:
          service: switch.turn_off
          data:
            entity_id: switch.bedroom_desklight
        set_level:
          service_template: "switch.turn_{{ 'on' if brightness > 50 else 'off' }}"
          entity_id: switch.bedroom_desklight_brightness

Whenever the brightness in the UI is set above 50, the light will be ‘high’ otherwise it will be ‘low’.