Badge name based on entity state

I’m extremely new to HA and yaml, so bare with me. I’ve been trying to understand yaml and css style - but it’s not going so well. My goal is to have a dynamic badge name, that changes based on the entity state.

The closest I ever got is this, but the name is stuck at [object Object] (I’m guessing that this is nowhere close of being right):

      - entity: sensor.moon_phases
        style: |
          :host {
            --label-badge-red: rgb(7,155,229);
          }
        name: 
          value_template: >-
            {% if is_state('sensor.moon', 'new_moon') %}New moon
            {% elif is_state('sensor.moon', 'waxing_crescent') %}Waxing cresent
            {% elif is_state('sensor.moon', 'first_quarter') %}First quarter
            {% elif is_state('sensor.moon', 'waxing_gibbous') %}Waxing gibbous
            {% elif is_state('sensor.moon', 'full_moon') %}Full moon
            {% elif is_state('sensor.moon', 'waning_gibbous') %}Waning gibbous
            {% elif is_state('sensor.moon', 'last_quarter') %}Last quarter
            {% elif is_state('sensor.moon', 'waning_crescent') %}Waning crescent
            {% endif %}