/*
 *   Copyright (c) 2012 Intellectual Reserve, Inc.  All rights reserved.
 *
 *   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 cf.nats.message;

import java.util.Map;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import cf.common.JsonObject;
import cf.nats.MessageBody;
import cf.nats.NatsSubject;

/**
 * Listens for staging messages.  Useful when you want to apply certain changes to an application only when it re-stages/restarts with service binding changes.
 * @author youngstrommj
 */

@NatsSubject("staging.*.start")
public class StagingStart extends JsonObject implements MessageBody<Void> {
	private final String appId;
	private final String taskId;
	private final String downloadUri;
	private final String uploadUri;
	private final String buildpackCacheDownloadUri;
	private final String buildpackCacheUploadUri;
	private final Map<String, Object> properties;

	@JsonCreator
	public StagingStart(
			@JsonProperty("app_id") String appId,
			@JsonProperty("task_id") String taskId,
			@JsonProperty("download_uri") String downloadUri,
			@JsonProperty("upload_uri") String uploadUri,
			@JsonProperty("buildpack_cache_download_uri") String buildpackCacheDownloadUri,
			@JsonProperty("buildpack_cache_upload_uri") String buildpackCacheUploadUri,
			@JsonProperty("properties") Map<String, Object> properties) {
		this.appId = appId;
		this.taskId = taskId;
		this.downloadUri = downloadUri;
		this.uploadUri = uploadUri;
		this.buildpackCacheDownloadUri = buildpackCacheDownloadUri;
		this.buildpackCacheUploadUri = buildpackCacheUploadUri;
		this.properties = properties;
	}

	public String getAppId() {
		return appId;
	}

	public String getTaskId() {
		return taskId;
	}

	public String getDownloadUri() {
		return downloadUri;
	}

	public String getUploadUri() {
		return uploadUri;
	}

	public String getBuildpackCacheDownloadUri() {
		return buildpackCacheDownloadUri;
	}

	public String getBuildpackCacheUploadUri() {
		return buildpackCacheUploadUri;
	}
	
	public Map<String, Object> getProperties() {
		return properties;
	}
}

@@ -701,16 +701,102 @@
 l.Map;%0A%0A
+import cf.common.JsonObject;%0Aimport cf.nats.MessageBody;%0Aimport cf.nats.NatsSubject;%0A%0A
 import c
@@ -899,94 +899,8 @@
 y;%0A%0A
-import cf.common.JsonObject;%0Aimport cf.nats.MessageBody;%0Aimport cf.nats.NatsSubject;%0A%0A
 /**%0A
@@ -1411,32 +1411,70 @@
 CacheUploadUri;%0A
+%09private final DeaStart startMessage;%0A
 %09private final M
@@ -1881,32 +1881,89 @@
 CacheUploadUri,%0A
+%09%09%09@JsonProperty(%22start_message%22) DeaStart startMessage,%0A
 %09%09%09@JsonProperty
@@ -2237,24 +2237,60 @@
 eUploadUri;%0A
+%09%09this.startMessage = startMessage;%0A
 %09%09this.prope
@@ -2700,16 +2700,81 @@
 i;%0A%09%7D%0A%09%0A
+%09public DeaStart getStartMessage() %7B%0A%09%09return startMessage;%0A%09%7D%0A%09%0A
 %09public 

Add start message to staging start.