package com.rnboat.framework.model;

import com.facebook.react.bridge.ReadableMap;
import com.google.gson.Gson;
import com.google.gson.JsonObject;

import org.json.JSONObject;

import java.util.HashMap;

/**
 * Created by Castiel on 2018/4/10.
 */

public class BaseParamsConfig {

    public Boolean getAnimated() {
        return animated;
    }

    public String getAnimationType() {
        return animationType;
    }

    public String getJumpType() {
        return jumpType;
    }

    public String getOpenType() {
        return openType;
    }

    public String getSceneName() {
        return sceneName;
    }

    public String getComponentName() {
        return componentName;
    }

    public String getHtmlUrl() {
        return htmlUrl;
    }

    public String getBundlePath() { return bundlePath; }

    public JsonObject getLaunchOptions() { return launchOptions; }

    public class AnimationType {
        public static final String FADE = "fade";
        public static final String SLIDE_HORIZONTAL = "slide_horizontal";
        public static final String SLIDE_VERTICAL = "slide_vertical";
    }

    public class JumpType {
        public static final String PUSH = "push";
        public static final String MODAL = "modal";
        public static final String RESET = "reset";
    }

    public class OpenType {
        public static final String NATIVE = "native";
        public static final String H5 = "h5";
    }

    private String sceneName = null;
    private String componentName = null;
    private Boolean animated = null;
    private String animationType = null;
    private String jumpType = null;
    private String openType = null;
    private String htmlUrl = null;
    private String bundlePath = null;
    private JsonObject launchOptions = null;

    public static BaseParamsConfig decodeParams(HashMap params) {
        Gson gson = new Gson();
        BaseParamsConfig baseParamsConfig = gson.fromJson(gson.toJson(params), BaseParamsConfig.class);
        return baseParamsConfig;
    }
}
