001package com.aispeech.dui.dds.agent;
002
003import org.json.JSONObject;
004
005public interface DMTaskCallback {
006    /**
007     * 支持callback的dmTask类型
008     */
009    enum Type {
010        /**
011         * dm.output
012         */
013        DM_OUTPUT("dm.output"),
014
015        /**
016         * rt.output
017         */
018        RT_OUTPUT("rt.output"),
019
020        /**
021         * cdm.error
022         */
023        CDM_ERROR("cdm.error");
024
025        private String value;
026
027        Type(String value) {
028            this.value = value;
029        }
030
031        public static Type getTypeByVal(String val) {
032            for (Type type : values()) {
033                if (type.value.equals(val)) {
034                    return type;
035                }
036            }
037            return null;
038        }
039    }
040
041    /**
042     * 对话task结果回调
043     *
044     * @param dmTaskResult 对话task结果
045     * @param type         结果类型{@link DMTaskCallback.Type}
046     * @return 返回dm task操作类型 : new JSONObject().put("ignore", true);
047     */
048    JSONObject onDMTaskResult(JSONObject dmTaskResult, Type type);
049}