{
  "id": "ddingtalk",
  "kind": "channel",
  "channels": ["ddingtalk"],
  "channelEnvVars": {
    "ddingtalk": ["DINGTALK_CLIENT_ID", "DINGTALK_CLIENT_SECRET"]
  },
  "configSchema": {
    "type": "object",
    "additionalProperties": false,
    "properties": {}
  },
  "channelConfigs": {
    "ddingtalk": {
      "label": "DingTalk",
      "description": "DingTalk enterprise robot with Stream mode for Chinese market.",
      "schema": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "name": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "clientId": {
            "type": "string",
            "description": "DingTalk AppKey / Client ID"
          },
          "clientSecret": {
            "type": "string",
            "description": "DingTalk AppSecret / Client Secret"
          },
          "allowFrom": {
            "type": "array",
            "items": {
              "anyOf": [{ "type": "string" }, { "type": "number" }]
            }
          },
          "dmPolicy": {
            "type": "string",
            "enum": ["open", "pairing", "allowlist"]
          },
          "groupPolicy": {
            "type": "string",
            "enum": ["open", "allowlist", "disabled"]
          },
          "groupAllowFrom": {
            "type": "array",
            "items": {
              "anyOf": [{ "type": "string" }, { "type": "number" }]
            }
          },
          "groups": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/definitions/dingTalkGroupConfig"
            }
          },
          "accounts": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/definitions/dingTalkAccountConfig"
            }
          },
          "defaultAccount": {
            "type": "string"
          }
        },
        "definitions": {
          "dingTalkGroupConfig": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "tools": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "allow": {
                    "type": "array",
                    "items": { "type": "string" }
                  },
                  "deny": {
                    "type": "array",
                    "items": { "type": "string" }
                  }
                }
              },
              "enabled": {
                "type": "boolean"
              },
              "allowFrom": {
                "type": "array",
                "items": {
                  "anyOf": [{ "type": "string" }, { "type": "number" }]
                }
              },
              "systemPrompt": {
                "type": "string"
              }
            }
          },
          "dingTalkAccountConfig": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "name": {
                "type": "string"
              },
              "enabled": {
                "type": "boolean"
              },
              "clientId": {
                "type": "string",
                "description": "DingTalk AppKey / Client ID"
              },
              "clientSecret": {
                "type": "string",
                "description": "DingTalk AppSecret / Client Secret"
              },
              "allowFrom": {
                "type": "array",
                "items": {
                  "anyOf": [{ "type": "string" }, { "type": "number" }]
                }
              },
              "groupPolicy": {
                "type": "string",
                "enum": ["open", "allowlist", "disabled"]
              },
              "groupAllowFrom": {
                "type": "array",
                "items": {
                  "anyOf": [{ "type": "string" }, { "type": "number" }]
                }
              },
              "groups": {
                "type": "object",
                "additionalProperties": {
                  "$ref": "#/definitions/dingTalkGroupConfig"
                }
              }
            }
          }
        }
      },
      "uiHints": {
        "name": {
          "label": "Account name"
        },
        "clientId": {
          "label": "DingTalk AppKey (Client ID)",
          "placeholder": "ding********"
        },
        "clientSecret": {
          "label": "DingTalk AppSecret (Client Secret)",
          "sensitive": true
        },
        "allowFrom": {
          "label": "DingTalk allowFrom user IDs"
        },
        "defaultAccount": {
          "label": "Default account"
        }
      }
    }
  }
}
