package ca.corefacility.bioinformatics.irida.model;

import javax.validation.constraints.NotNull;

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

/**
 * An interface for all model classes in the IRIDA system
 * 
 */
public interface IridaThing extends Timestamped {
	/**
	 * Get a human readable label for this object.
	 * 
	 * @return a human-readable label for the object.
	 */
	@NotNull(message = "{irida.label.notnull}")
	@JsonProperty
	public String getLabel();

	/**
	 * Method supporting JSON deserialzation. This method should not be used and
	 * will throw UnsupportedOperationException when called.
	 * 
	 * @param label
	 *            label param
	 * @throws UnsupportedOperationException
	 *             A label cannot be set for an object. It should be computed
	 *             from the object's properties.
	 */
	@JsonIgnore
	public default void setLabel(String label) throws UnsupportedOperationException {
		throw new UnsupportedOperationException("Label cannot be set on an object.");
	}

	/**
	 * Get the numerical identifier for this object
	 * 
	 * @return the numerical identifier for the object
	 */
	@JsonProperty("identifier")
	public Long getId();

	/**
	 * Set the numerical identifier for this object
	 * 
	 * @param id
	 *            The ID to set
	 */
	@JsonProperty("identifier")
	public void setId(Long id);

}

@@ -1181,38 +1181,22 @@
 /%0A%09@Json
-Property(%22identifier%22)
+Ignore
 %0A%09public
@@ -1347,16 +1347,16 @@
 ifier%22)%0A
-
 %09public 
@@ -1377,10 +1377,324 @@
 g id);%0A%0A
+%09/**%0A%09 * Get the id parameter as a string. This method is here to ensure%0A%09 * compatibility with previous clients which use the IRIDA REST API. It may%0A%09 * be removed once APIv2 is released.%0A%09 * %0A%09 * @return%0A%09 */%0A%09@JsonProperty(%22identifier%22)%0A%09public default String getIdentifier() %7B%0A%09%09return getId().toString();%0A%09%7D%0A%0A
 %7D%0A

serialize the identifier as a string