实例化结构枚举

Instantiating a structure-enum

所以我有一个 structure-enum 看起来像:

integer (Id) {}

enum (Color) {
  symbol (red)
  symbol (orange)
  symbol (yellow)
  symbol (green)
  symbol (blue)
  symbol (indigo)
  symbol (violet)
}

structure-enum (ColorId) {
  property (color) {
    type (Color)
    min (Required)
    max (One)
  }
  property (id) {
    type (Id)
    min (Required)
    max (One)
  }
  constant: ColorId {
    color: (red)
    id: (1)
  }
  constant: ColorId {
    color: (orange)
    id: (2)
  }
  constant: ColorId {
    color: (yellow)
    id: (3)
  }
  constant: ColorId {
    color: (green)
    id: (4)
  }
  constant: ColorId {
    color: (blue)
    id: (5)
  }
  constant: ColorId {
    color: (indigo)
    id: (6)
  }
  constant: ColorId {
    color: (violet)
    id: (7)
  }
}

我想要一个看起来像这样的动作:

action (SomeAction) {
  collect {
    input (colorId) {
      type (ColorId)
      min (Required) 
      max (One)
    }
  }
  output (SomeOutput)
}

我希望用户能够说出 Color 之一(我有词汇),让 Bixby 将该颜色与 structure-enum 之一匹配并将其输入我的行动。因此,例如,用户可以说 "yellow",Bixby 会将其匹配到 structure-enum:

constant: ColorId {
  color: (yellow)
  id: (3)
}

并将其用作我的操作的输入。基本上我想知道如何获取用户话语并将其实例化为 structure-enum。我该怎么做?

structure-enum 确实适合这个用例。

您可能有以下常量,语法仍然有效。

constant: ColorId {
    color: (red)
    id: (1)
  }
  constant: ColorId {
    color: (red)
    id: (11)
  }
  constant: ColorId {
    color: (red)
    id: (31)
  }

保留枚举 Color 并在 JS 文件和 return Id 中查找。