package mesosphere.marathon.client.model.v2;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import mesosphere.marathon.client.utils.ModelUtils;

public class App {
	private String id;
	private String cmd;
	private Integer instances;
	private Double cpus;
	private Double mem;
	private Collection<String> uris;
	private List<List<String>> constraints;
	private Container container;
	private Map<String, String> env;
	private String executor;
	private List<Integer> ports;
	private Collection<Task> tasks;
	private Integer tasksStaged;
	private Integer tasksRunning;
    private Collection<HealthCheck> healthChecks;
    private UpgradeStrategy upgradeStrategy;
    private Collection<Deployment> deployments;

    public UpgradeStrategy getUpgradeStrategy() {
        return upgradeStrategy;
    }

    public void setUpgradeStrategy(UpgradeStrategy upgradeStrategy) {
        this.upgradeStrategy = upgradeStrategy;
    }

    public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getCmd() {
		return cmd;
	}

	public void setCmd(String cmd) {
		this.cmd = cmd;
	}

	public Integer getInstances() {
		return instances;
	}

	public void setInstances(Integer instances) {
		this.instances = instances;
	}

	public Double getCpus() {
		return cpus;
	}

	public void setCpus(Double cpus) {
		this.cpus = cpus;
	}

	public Double getMem() {
		return mem;
	}

	public void setMem(Double mem) {
		this.mem = mem;
	}

	public Collection<String> getUris() {
		return uris;
	}

	public void setUris(Collection<String> uris) {
		this.uris = uris;
	}

	public List<List<String>> getConstraints() {
		return constraints;
	}

	public void setConstraints(List<List<String>> constraints) {
		this.constraints = constraints;
	}

	public void addConstraint(String attribute, String operator, String value) {
		if (this.constraints == null) {
			this.constraints = new ArrayList<List<String>>();
		}
		List<String> constraint = new ArrayList<String>(3);
		constraint.add(attribute == null ? "" : attribute);
		constraint.add(operator == null ? "" : operator);
		constraint.add(value == null ? "" : value);
		this.constraints.add(constraint);
	}

	public Container getContainer() {
		return container;
	}

	public void setContainer(Container container) {
		this.container = container;
	}

	public Map<String, String> getEnv() {
		return env;
	}

	public void setEnv(Map<String, String> env) {
		this.env = env;
	}

	public String getExecutor() {
		return executor;
	}

	public void setExecutor(String executor) {
		this.executor = executor;
	}

	public List<Integer> getPorts() {
		return ports;
	}

	public void setPorts(List<Integer> ports) {
		this.ports = ports;
	}

	public void addUri(String uri) {
		if (this.uris == null) {
			this.uris = new ArrayList<String>();
		}
		this.uris.add(uri);
	}

	public void addPort(int port) {
		if (this.ports == null) {
			this.ports = new ArrayList<Integer>();
		}
		this.ports.add(port);
	}

	public Collection<Task> getTasks() {
		return tasks;
	}

	public void setTasks(Collection<Task> tasks) {
		this.tasks = tasks;
	}

	public Integer getTasksStaged() {
		return tasksStaged;
	}

	public void setTasksStaged(Integer tasksStaged) {
		this.tasksStaged = tasksStaged;
	}

	public Integer getTasksRunning() {
		return tasksRunning;
	}

	public void setTasksRunning(Integer tasksRunning) {
		this.tasksRunning = tasksRunning;
	}

    public Collection<HealthCheck> getHealthChecks() {
        return healthChecks;
    }

    public void setHealthChecks(Collection<HealthCheck> healthChecks) {
        this.healthChecks = healthChecks;
    }

    public void addHealthCheck(HealthCheck healthCheck) {
        this.healthChecks = (this.healthChecks != null) ? this.healthChecks : new ArrayList<HealthCheck>();
        this.healthChecks.add(healthCheck);
    }

    public Collection<Deployment> getDeployments() {
        return deployments;
    }

    public void setDeployments(Collection<Deployment> deployments) {
        this.deployments = deployments;
    }
    
    public void addDeployment(Deployment deployment) {
        this.deployments = (this.deployments != null) ? this.deployments : new ArrayList<Deployment>();
        this.deployments.add(deployment);
    }

	@Override
	public String toString() {
		return ModelUtils.toString(this);
	}

}

@@ -96,16 +96,42 @@
 ection;%0A
+import java.util.HashMap;%0A
 import j
@@ -491,16 +491,53 @@
 g%3E env;%0A
+%09private Map%3CString, String%3E labels;%0A
 %09private
@@ -4367,16 +4367,326 @@
 %0A    %7D%0A%0A
+%09public Map%3CString, String%3E getLabels() %7B%0A%09%09return labels;%0A%09%7D%0A%0A%09public void setLabels(Map%3CString, String%3E labels) %7B%0A%09%09this.labels = labels;%0A%09%7D%0A%0A%09public void addLabel(String key, String value) %7B%0A%09%09if (this.labels == null) %7B%0A%09%09%09this.labels = new HashMap%3CString, String%3E();%0A%09%09%7D%0A%09%09this.labels.put(key, value);%0A%09%7D%0A%0A
 %09@Overri

Add labels to App