Two function one button one click esphome

how to write a code for a button that turns on one relay the first time you press it and the second relay when you press it a second time?

What about the third and fourth times?

That’s what I meant. If someone wanted to create a button with an LED indicator and a relay with two coils then lower the function code.

switch:
##RELAY 1 PUMP
#relay 1 ON
  - platform: gpio
    name: "${friendly_name} Switch 1 Pump ON"
    pin: 25
    id: relay1_on
    on_turn_on:
    - delay: 500ms
    - switch.turn_off: relay1_on
    restore_mode: ALWAYS_OFF
    internal: true
#relay 1 OFF
  - platform: gpio
    name: "${friendly_name} Switch 1 Pump OFF"
    pin: 14
    id: relay1_off
    on_turn_on:
    - delay: 500ms
    - switch.turn_off: relay1_off
    restore_mode: ALWAYS_OFF
    internal: true

  - platform: template
    name: "${friendly_name} Switch 1"
    id: relay_template
    restore_state: off
    optimistic: true
    turn_on_action:
      - switch.turn_on: relay1_on
      - switch.turn_on: led_relay1
    turn_off_action:
      - switch.turn_on: relay1_off
      - switch.turn_off: led_relay1

#led 1
  - platform: gpio
    name: "${friendly_name} Led Relay 1"
    pin: 5
    id: led_relay1
    internal: true
    restore_mode: RESTORE_DEFAULT_OFF

binary_sensor:
##RELAY 1
#button 1
  - platform: gpio
    name: "${friendly_name} Switch Button 1"
    pin:
      number: 19
    id: button1
    filters:
      - invert:
      - delayed_on: 10ms
    on_press:
      then:
        - switch.toggle: relay_template
    internal: true