package com.k_int.ciim.ui.json;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

import org.springframework.stereotype.Component;

import com.k_int.ciim.data.hdo.PropertyHDO;
import com.sun.jersey.api.view.ImplicitProduces;

@XmlRootElement(name="property") 
@ImplicitProduces("application/json;qs=5")
@XmlAccessorType(XmlAccessType.FIELD)
@Component
public class PropertyJSON 
{
	private String id = null;
	private String mapping_key = null;
	private String name = null;
	private String description = null;
	private String property_type = null;
	
	protected PropertyJSON(){;}
	
	public PropertyJSON(PropertyHDO hdo)
	{
		if(hdo != null)
		{
			//we could null check id first but it should never ever (ever!) be null
			this.id = hdo.getId().toString();
			
			this.mapping_key = hdo.getMappingKey();
			this.name = hdo.getName();
			this.description = hdo.getDescription();
			
			if(hdo.getPropertyType() != null)
			{
				this.property_type = hdo.getPropertyType().toString();
			}
		}
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getMappingKey() {
		return mapping_key;
	}

	public void setMappingKey(String mappingKey) {
		mapping_key = mappingKey;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getPropertyType() {
		return property_type;
	}

	public void setPropertyType(String propertyType) {
		property_type = propertyType;
	}
}
