# Describes the format for available light services
.brightness_support: &brightness_support
  attribute:
    supported_color_modes:
      - light.ColorMode.BRIGHTNESS
      - light.ColorMode.COLOR_TEMP
      - light.ColorMode.HS
      - light.ColorMode.XY
      - light.ColorMode.RGB
      - light.ColorMode.RGBW
      - light.ColorMode.RGBWW

.color_support: &color_support
  attribute:
    supported_color_modes:
      - light.ColorMode.HS
      - light.ColorMode.XY
      - light.ColorMode.RGB
      - light.ColorMode.RGBW
      - light.ColorMode.RGBWW

.color_temp_support: &color_temp_support
  attribute:
    supported_color_modes:
      - light.ColorMode.COLOR_TEMP
      - light.ColorMode.HS
      - light.ColorMode.XY
      - light.ColorMode.RGB
      - light.ColorMode.RGBW
      - light.ColorMode.RGBWW

.named_colors: &named_colors
  - "homeassistant"
  - "aliceblue"
  - "antiquewhite"
  - "aqua"
  - "aquamarine"
  - "azure"
  - "beige"
  - "bisque"
  # Black is omitted from this list as nonsensical for lights
  - "blanchedalmond"
  - "blue"
  - "blueviolet"
  - "brown"
  - "burlywood"
  - "cadetblue"
  - "chartreuse"
  - "chocolate"
  - "coral"
  - "cornflowerblue"
  - "cornsilk"
  - "crimson"
  - "cyan"
  - "darkblue"
  - "darkcyan"
  - "darkgoldenrod"
  - "darkgray"
  - "darkgreen"
  - "darkgrey"
  - "darkkhaki"
  - "darkmagenta"
  - "darkolivegreen"
  - "darkorange"
  - "darkorchid"
  - "darkred"
  - "darksalmon"
  - "darkseagreen"
  - "darkslateblue"
  - "darkslategray"
  - "darkslategrey"
  - "darkturquoise"
  - "darkviolet"
  - "deeppink"
  - "deepskyblue"
  - "dimgray"
  - "dimgrey"
  - "dodgerblue"
  - "firebrick"
  - "floralwhite"
  - "forestgreen"
  - "fuchsia"
  - "gainsboro"
  - "ghostwhite"
  - "gold"
  - "goldenrod"
  - "gray"
  - "green"
  - "greenyellow"
  - "grey"
  - "honeydew"
  - "hotpink"
  - "indianred"
  - "indigo"
  - "ivory"
  - "khaki"
  - "lavender"
  - "lavenderblush"
  - "lawngreen"
  - "lemonchiffon"
  - "lightblue"
  - "lightcoral"
  - "lightcyan"
  - "lightgoldenrodyellow"
  - "lightgray"
  - "lightgreen"
  - "lightgrey"
  - "lightpink"
  - "lightsalmon"
  - "lightseagreen"
  - "lightskyblue"
  - "lightslategray"
  - "lightslategrey"
  - "lightsteelblue"
  - "lightyellow"
  - "lime"
  - "limegreen"
  - "linen"
  - "magenta"
  - "maroon"
  - "mediumaquamarine"
  - "mediumblue"
  - "mediumorchid"
  - "mediumpurple"
  - "mediumseagreen"
  - "mediumslateblue"
  - "mediumspringgreen"
  - "mediumturquoise"
  - "mediumvioletred"
  - "midnightblue"
  - "mintcream"
  - "mistyrose"
  - "moccasin"
  - "navajowhite"
  - "navy"
  - "navyblue"
  - "oldlace"
  - "olive"
  - "olivedrab"
  - "orange"
  - "orangered"
  - "orchid"
  - "palegoldenrod"
  - "palegreen"
  - "paleturquoise"
  - "palevioletred"
  - "papayawhip"
  - "peachpuff"
  - "peru"
  - "pink"
  - "plum"
  - "powderblue"
  - "purple"
  - "red"
  - "rosybrown"
  - "royalblue"
  - "saddlebrown"
  - "salmon"
  - "sandybrown"
  - "seagreen"
  - "seashell"
  - "sienna"
  - "silver"
  - "skyblue"
  - "slateblue"
  - "slategray"
  - "slategrey"
  - "snow"
  - "springgreen"
  - "steelblue"
  - "tan"
  - "teal"
  - "thistle"
  - "tomato"
  - "turquoise"
  - "violet"
  - "wheat"
  - "white"
  - "whitesmoke"
  - "yellow"
  - "yellowgreen"

turn_on:
  target:
    entity:
      domain: light
  fields:
    transition: &transition
      filter:
        supported_features:
          - light.LightEntityFeature.TRANSITION
      selector:
        number:
          min: 0
          max: 300
          unit_of_measurement: seconds
    rgb_color: &rgb_color
      filter: *color_support
      example: "[255, 100, 100]"
      selector:
        color_rgb:
    kelvin: &kelvin
      filter: *color_temp_support
      selector:
        color_temp:
          unit: "kelvin"
          min: 2000
          max: 6500
    brightness_pct: &brightness_pct
      filter: *brightness_support
      selector:
        number:
          min: 0
          max: 100
          unit_of_measurement: "%"
    brightness_step_pct:
      filter: *brightness_support
      selector:
        number:
          min: -100
          max: 100
          unit_of_measurement: "%"
    effect: &effect
      filter:
        supported_features:
          - light.LightEntityFeature.EFFECT
      selector:
        text:
    advanced_fields:
      collapsed: true
      fields:
        rgbw_color: &rgbw_color
          filter: *color_support
          example: "[255, 100, 100, 50]"
          selector:
            object:
        rgbww_color: &rgbww_color
          filter: *color_support
          example: "[255, 100, 100, 50, 70]"
          selector:
            object:
        color_name: &color_name
          filter: *color_support
          selector:
            select:
              translation_key: color_name
              options: *named_colors
        hs_color: &hs_color
          filter: *color_support
          example: "[300, 70]"
          selector:
            object:
        xy_color: &xy_color
          filter: *color_support
          example: "[0.52, 0.43]"
          selector:
            object:
        color_temp: &color_temp
          filter: *color_temp_support
          selector:
            color_temp:
              unit: "mired"
              min: 153
              max: 500
        brightness: &brightness
          filter: *brightness_support
          selector:
            number:
              min: 0
              max: 255
        brightness_step:
          filter: *brightness_support
          selector:
            number:
              min: -225
              max: 255
        white: &white
          filter:
            attribute:
              supported_color_modes:
                - light.ColorMode.WHITE
          selector:
            constant:
              value: true
              label: Enabled
        profile: &profile
          example: relax
          selector:
            text:
        flash: &flash
          filter:
            supported_features:
              - light.LightEntityFeature.FLASH
          selector:
            select:
              options:
                - label: "Long"
                  value: "long"
                - label: "Short"
                  value: "short"

turn_off:
  target:
    entity:
      domain: light
  fields:
    transition: *transition
    advanced_fields:
      collapsed: true
      fields:
        flash: *flash

toggle:
  target:
    entity:
      domain: light
  fields:
    transition: *transition
    rgb_color: *rgb_color
    kelvin: *kelvin
    brightness_pct: *brightness_pct
    effect: *effect
    advanced_fields:
      collapsed: true
      fields:
        rgbw_color: *rgbw_color
        rgbww_color: *rgbww_color
        color_name: *color_name
        hs_color: *hs_color
        xy_color: *xy_color
        color_temp: *color_temp
        brightness: *brightness
        white: *white
        profile: *profile
        flash: *flash
