// Path: sdk/src/com/kakao/internal/Action.java
// public class Action {
//     public enum ACTION_TYPE {
//         WEB("web"),
//         APP("app");
//         private final String value;
// 
//         ACTION_TYPE(String value) {
//             this.value = value;
//         }
//     }
// 
//     private ACTION_TYPE type;
//     private ActionInfo[] actionInfos;
//     private String url;
// 
// 
//     private Action(final ACTION_TYPE type, final String url, final ActionInfo[] actionInfos) throws KakaoLinkParseException {
//         if (type == null) {
//             throw new KakaoLinkParseException(KakaoLinkParseException.ERROR_CODE.CORE_PARAMETER_MISSING, "action needs type.");
//         }
//         this.type = type;
// 
//         if ((type == ACTION_TYPE.WEB) && !TextUtils.isEmpty(url)) {
//             this.url = url;
//         }
// 
//         if (type == ACTION_TYPE.APP && !(actionInfos == null || actionInfos.length == 0)) {
//             this.actionInfos = actionInfos;
//         }
//     }
// 
//     public static Action newActionApp(final ActionInfo[] actionInfos) throws KakaoLinkParseException {
//         return new Action(ACTION_TYPE.APP, null, actionInfos);
//     }
// 
//     public static Action newActionWeb(final String url) throws KakaoLinkParseException {
//         return new Action(ACTION_TYPE.WEB, url, null);
//     }
// 
//     public JSONObject createJSONObject() throws JSONException {
//         JSONObject json = new JSONObject();
//         json.put(KakaoTalkLinkProtocol.ACTION_TYPE, type.value);
//         if (url != null) {
//             json.put(KakaoTalkLinkProtocol.ACTION_URL, url);
//         }
//         if (actionInfos != null) {
//             JSONArray jsonObjs = new JSONArray();
//             for (ActionInfo obj : actionInfos) {
//                 jsonObjs.put(obj.createJSONObject());
//             }
//             json.put(KakaoTalkLinkProtocol.ACTION_ACTIONINFO, jsonObjs);
//         }
//         return json;
//     }
// }
// 
// Path: sdk/src/com/kakao/internal/ActionInfo.java
// public class ActionInfo {
//     enum ACTION_INFO_OS {
//         ANDROID("android"),
//         IOS("ios");
// 
//         private final String value;
// 
//         ACTION_INFO_OS(String value) {
//             this.value = value;
//         }
//     }
// 
//     private final ACTION_INFO_OS os;
//     private final DEVICE_TYPE deviceType;
//     private final String executeParam;
// 
//     private ActionInfo(final ACTION_INFO_OS os, final String executeParam, final DEVICE_TYPE deviceType) {
//         this.os = os;
//         this.executeParam = executeParam;
//         this.deviceType = deviceType;
//     }
// 
//     public static ActionInfo createAndroidActionInfo(final String executeParam, final DEVICE_TYPE deviceType){
//         return new ActionInfo(ACTION_INFO_OS.ANDROID, executeParam, deviceType);
//     }
// 
//     public static ActionInfo createIOSActionInfo(final String executeParam, final DEVICE_TYPE deviceType){
//         return new ActionInfo(ACTION_INFO_OS.IOS, executeParam, deviceType);
//     }
// 
//     JSONObject createJSONObject() throws JSONException {
//         JSONObject json = new JSONObject();
//         json.put(KakaoTalkLinkProtocol.ACTIONINFO_OS, os.value);
// 
//         if (!TextUtils.isEmpty(executeParam)) {
//             json.put(KakaoTalkLinkProtocol.ACTIONINFO_EXEC_PARAM, executeParam);
//         }
// 
//         if (deviceType != null) {
//             json.put(KakaoTalkLinkProtocol.ACTIONINFO_DEVICETYPE, deviceType.getValue());
//         }
//         return json;
//     }
// }


import java.util.Set;
import com.kakao.internal.Action;
import com.kakao.internal.ActionInfo;
import java.util.HashSet;
/**
 * Copyright 2014 Minyoung Jeong <kkungkkung@gmail.com>
 * Copyright 2014 Kakao Corp.
 *
 * Redistribution and modification in source or binary forms are not permitted without specific prior written permission. 
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.kakao;



/**
 * 카카오링크 톡메시지 중 앱으로 연결할 url을 설정하는 Builder
 * OS별, 디바이스별 설정이 가능하다.
* @author MJ
*/
public class AppActionBuilder {
    /**
     * 앱으로 연결할 url을 디바이스별로 구분할 때 사용된다.
     */
    public enum DEVICE_TYPE {
        /**
         * 핸드폰
         */
        PHONE("phone"),
        /**
         * 패드
         */
        PAD("pad");

        private final String value;

        DEVICE_TYPE(String value) {
            this.value = value;
        }

        /**
         * 디바이스 종류의 string 값
         * 메시지를 json으로 만들때 사용된다.
         * @return 디바이스 종류의 string 값. 메시지를 json으로 만들때 사용된다.
         */
        public String getValue() {
            return value;
        }
    }

// Path: sdk/src/com/kakao/internal/Action.java
// public class Action {
//     public enum ACTION_TYPE {
//         WEB("web"),
//         APP("app");
//         private final String value;
// 
//         ACTION_TYPE(String value) {
//             this.value = value;
//         }
//     }
// 
//     private ACTION_TYPE type;
//     private ActionInfo[] actionInfos;
//     private String url;
// 
// 
//     private Action(final ACTION_TYPE type, final String url, final ActionInfo[] actionInfos) throws KakaoLinkParseException {
//         if (type == null) {
//             throw new KakaoLinkParseException(KakaoLinkParseException.ERROR_CODE.CORE_PARAMETER_MISSING, "action needs type.");
//         }
//         this.type = type;
// 
//         if ((type == ACTION_TYPE.WEB) && !TextUtils.isEmpty(url)) {
//             this.url = url;
//         }
// 
//         if (type == ACTION_TYPE.APP && !(actionInfos == null || actionInfos.length == 0)) {
//             this.actionInfos = actionInfos;
//         }
//     }
// 
//     public static Action newActionApp(final ActionInfo[] actionInfos) throws KakaoLinkParseException {
//         return new Action(ACTION_TYPE.APP, null, actionInfos);
//     }
// 
//     public static Action newActionWeb(final String url) throws KakaoLinkParseException {
//         return new Action(ACTION_TYPE.WEB, url, null);
//     }
// 
//     public JSONObject createJSONObject() throws JSONException {
//         JSONObject json = new JSONObject();
//         json.put(KakaoTalkLinkProtocol.ACTION_TYPE, type.value);
//         if (url != null) {
//             json.put(KakaoTalkLinkProtocol.ACTION_URL, url);
//         }
//         if (actionInfos != null) {
//             JSONArray jsonObjs = new JSONArray();
//             for (ActionInfo obj : actionInfos) {
//                 jsonObjs.put(obj.createJSONObject());
//             }
//             json.put(KakaoTalkLinkProtocol.ACTION_ACTIONINFO, jsonObjs);
//         }
//         return json;
//     }
// }
// 
// Path: sdk/src/com/kakao/internal/ActionInfo.java
// public class ActionInfo {
//     enum ACTION_INFO_OS {
//         ANDROID("android"),
//         IOS("ios");
// 
//         private final String value;
// 
//         ACTION_INFO_OS(String value) {
//             this.value = value;
//         }
//     }
// 
//     private final ACTION_INFO_OS os;
//     private final DEVICE_TYPE deviceType;
//     private final String executeParam;
// 
//     private ActionInfo(final ACTION_INFO_OS os, final String executeParam, final DEVICE_TYPE deviceType) {
//         this.os = os;
//         this.executeParam = executeParam;
//         this.deviceType = deviceType;
//     }
// 
//     public static ActionInfo createAndroidActionInfo(final String executeParam, final DEVICE_TYPE deviceType){
//         return new ActionInfo(ACTION_INFO_OS.ANDROID, executeParam, deviceType);
//     }
// 
//     public static ActionInfo createIOSActionInfo(final String executeParam, final DEVICE_TYPE deviceType){
//         return new ActionInfo(ACTION_INFO_OS.IOS, executeParam, deviceType);
//     }
// 
//     JSONObject createJSONObject() throws JSONException {
//         JSONObject json = new JSONObject();
//         json.put(KakaoTalkLinkProtocol.ACTIONINFO_OS, os.value);
// 
//         if (!TextUtils.isEmpty(executeParam)) {
//             json.put(KakaoTalkLinkProtocol.ACTIONINFO_EXEC_PARAM, executeParam);
//         }
// 
//         if (deviceType != null) {
//             json.put(KakaoTalkLinkProtocol.ACTIONINFO_DEVICETYPE, deviceType.getValue());
//         }
//         return json;
//     }
// }


// Path: sdk/src/com/kakao/AppActionBuilder.java
import java.util.Set;
import com.kakao.internal.Action;
import com.kakao.internal.ActionInfo;
import java.util.HashSet;

/**
 * Copyright 2014 Minyoung Jeong <kkungkkung@gmail.com>
 * Copyright 2014 Kakao Corp.
 *
 * Redistribution and modification in source or binary forms are not permitted without specific prior written permission. 
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.kakao;



/**
 * 카카오링크 톡메시지 중 앱으로 연결할 url을 설정하는 Builder
 * OS별, 디바이스별 설정이 가능하다.
* @author MJ
*/
public class AppActionBuilder {
    /**
     * 앱으로 연결할 url을 디바이스별로 구분할 때 사용된다.
     */
    public enum DEVICE_TYPE {
        /**
         * 핸드폰
         */
        PHONE("phone"),
        /**
         * 패드
         */
        PAD("pad");

        private final String value;

        DEVICE_TYPE(String value) {
            this.value = value;
        }

        /**
         * 디바이스 종류의 string 값
         * 메시지를 json으로 만들때 사용된다.
         * @return 디바이스 종류의 string 값. 메시지를 json으로 만들때 사용된다.
         */
        public String getValue() {
            return value;
        }
    }

    private final Set<ActionInfo> actionInfos;