package com.github.bigquery.dashboard.model;

import com.googlecode.objectify.Key;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Parent;
import com.googlecode.objectify.annotation.Subclass;

import java.util.Date;
import java.util.List;

/**
 * Created by b002kla on 18/12/2014.
 */
@Entity
public abstract class AbstractQueryParam {
    @Parent
    private Key<BigQuery> bigQuery;
    @Id
    private String name;
    private Type type;

    public Key<BigQuery> getBigQuery() {
        return bigQuery;
    }

    public void setBigQuery(Key<BigQuery> bigQuery) {
        this.bigQuery = bigQuery;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }

    static public enum Type {
        TEXT, DATE, LIST, NUMBER
    }

    @Subclass
    public static class TextQueryParam extends AbstractQueryParam {
        private String defaultValue;

        public String getDefaultValue() {
            return defaultValue;
        }

        public void setDefaultValue(String defaultValue) {
            this.defaultValue = defaultValue;
        }
    }
    @Subclass
    public static class DateQueryParam extends AbstractQueryParam {
        private Date defaultValue;

        public Date getDefaultValue() {
            return defaultValue;
        }

        public void setDefaultValue(Date defaultValue) {
            this.defaultValue = defaultValue;
        }
    }
    @Subclass
    public static class NumberQueryParam extends AbstractQueryParam {
        private Number defaultValue;

        public Number getDefaultValue() {
            return defaultValue;
        }

        public void setDefaultValue(Number defaultValue) {
            this.defaultValue = defaultValue;
        }
    }
    @Subclass
    public static class ListQueryParam extends AbstractQueryParam {
        private List<String> values; // for Type LIST
        private String defaultValue;

        public List<String> getValues() {
            return values;
        }

        public void setValues(List<String> values) {
            this.values = values;
        }

        public String getDefaultValue() {
            return defaultValue;
        }

        public void setDefaultValue(String defaultValue) {
            this.defaultValue = defaultValue;
        }
    }
}

@@ -39,16 +39,59 @@
 model;%0A%0A
+import com.google.gson.annotations.Expose;%0A
 import c
@@ -119,16 +119,16 @@
 fy.Key;%0A
-
 import c
@@ -521,16 +521,28 @@
     @Id%0A
+    @Expose%0A
     priv
@@ -554,24 +554,74 @@
 tring name;%0A
+    @Expose%0A    private String label;%0A    @Expose%0A
     private 
@@ -1052,24 +1052,160 @@
 ype;%0A    %7D%0A%0A
+    public String getLabel() %7B%0A        return label;%0A    %7D%0A%0A    public void setLabel(String label) %7B%0A        this.label = label;%0A    %7D%0A%0A
     static p
@@ -1336,32 +1336,48 @@
 actQueryParam %7B%0A
+        @Expose%0A
         private 
@@ -1679,32 +1679,48 @@
 actQueryParam %7B%0A
+        @Expose%0A
         private 
@@ -2018,32 +2018,48 @@
 actQueryParam %7B%0A
+        @Expose%0A
         private 
@@ -2361,32 +2361,48 @@
 actQueryParam %7B%0A
+        @Expose%0A
         private 
@@ -2439,16 +2439,32 @@
 pe LIST%0A
+        @Expose%0A
         

Add label