Problems creating a esphome script that takes use of my parameter

I’ve managed to create this script:

  - id: update_light1
    mode: queued
    then:
      - lambda: |-
                ESP_LOGD("custom", "light1_common_state: %d", id(light1_common_state));    
      - if:
          condition:
            lambda: 'return (id(light1_common_state) == 0);'
          then:
            - logger.log: Turning off light 1
      - if:
          condition:
            lambda: 'return (id(light1_common_state) == 1);'
          then:
            - logger.log: Turning on light 1

Thats all great but I would really like if I dont need to have that script for each light but instead could parse a param when I call the script.

I know how to define the

  - id: update_light
    mode: queued
    parameters:
      light: string

And I know how to call it including a param.
But I dont know how to take use of the param in the above code .
Whenever the code says light1 it should use the content of the parameter.
Can anyone help me ?