package com.crowdmap.java.sdk.model.form;

import com.crowdmap.java.sdk.annotations.Form;
import com.crowdmap.java.sdk.annotations.FormField;
import com.crowdmap.java.sdk.util.ValidateUtil;

import java.io.File;

/**
 * Posts form
 */
public class PostForm extends Form {

    @FormField(name = "message")
    private String message;

    @FormField(name = "public")
    private boolean isPublic;

    @FormField(name = "locations[name]")
    private String locationName;

    @FormField(name = "locations[lat]")
    private double lat;

    @FormField(name = "locations[lon]")
    private double lon;

    @FormField(name = "locations[geometry]")
    private String geometry;

    @FormField(name = "locations[fsq_venue_id]")
    private int fsqVenueId;

    @FormField(name = "tweet")
    private int tweet;

    @FormField(name = "externals[url]")
    private String externalUrl;

    @FormField(name = "media[file]")
    private File media;

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        if (ValidateUtil.empty(message)) {
            throw new IllegalArgumentException("Message cannot be empty or null");
        }
        this.message = message;
    }

    public boolean getPublic() {
        return isPublic;
    }

    public void setPublic(boolean aPublic) {
        isPublic = aPublic;
    }

    public String getLocationName() {
        return locationName;
    }

    public void setLocationName(String locationName) {
        this.locationName = locationName;
    }

    public double getLat() {
        return lat;
    }

    public void setLat(double lat) {
        this.lat = lat;
    }

    public String getGeometry() {
        return geometry;
    }

    public void setGeometry(String geometry) {
        this.geometry = geometry;
    }

    public double getLon() {
        return lon;
    }

    public void setLon(double lon) {
        this.lon = lon;
    }

    public int getFsqVenueId() {
        return fsqVenueId;
    }

    public void setFsqVenueId(int fsqVenueId) {
        this.fsqVenueId = fsqVenueId;
    }

    public int getTweet() {
        return tweet;
    }

    public void setTweet(int tweet) {
        this.tweet = tweet;
    }

    public String getExternalUrl() {
        return externalUrl;
    }

    public void setExternalUrl(String externalUrl) {
        this.externalUrl = externalUrl;
    }

    public File getMedia() {
        return media;
    }

    public void setMedia(File media) {
        this.media = media;
    }

    @Override
    public String toString() {
        return "PostForm{" +
                "message='" + message + '\'' +
                ", isPublic=" + isPublic +
                '}';
    }
}

@@ -749,16 +749,70 @@
 nueId;%0A%0A
+    @FormField(name=%22map_id%22)%0A    private int mapId;%0A%0A
     @For
@@ -2592,24 +2592,154 @@
 dia;%0A    %7D%0A%0A
+    public int getMapId() %7B%0A        return mapId;%0A    %7D%0A%0A    public void setMapId(int mapId) %7B%0A        this.mapId = mapId;%0A    %7D%0A%0A
     @Overrid
@@ -2890,16 +2890,407 @@
 ublic +%0A
+                %22, locationName='%22 + locationName + '%5C'' +%0A                %22, lat=%22 + lat +%0A                %22, lon=%22 + lon +%0A                %22, geometry='%22 + geometry + '%5C'' +%0A                %22, fsqVenueId=%22 + fsqVenueId +%0A                %22, mapId=%22 + mapId +%0A                %22, tweet=%22 + tweet +%0A                %22, externalUrl='%22 + externalUrl + '%5C'' +%0A                %22, media=%22 + media +%0A
         

Add map id when creating a new post