package com.agilex.healthcare.schedulingmanager.domain;

import com.agilex.healthcare.mobilehealthplatform.domain.DomainTransferObject;
import com.agilex.healthcare.utility.datemarshallers.DateTimeMarshaller;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.Date;

@XmlAccessorType(value = XmlAccessType.NONE)
@XmlRootElement(name = "appointmentRequestDetailCode", namespace = Namespace.SchedulingManager)
public class SMAppointmentRequestDetailCode extends DomainTransferObject implements Comparable<SMAppointmentRequestDetailCode> {
	private static final long serialVersionUID = -7731727560159684968L;

	@XmlElement
	private String appointmentRequestDetailCodeId;
	
	@XmlElement
	@XmlJavaTypeAdapter(DateTimeMarshaller.class)
	private Date createdDate;
	
	@XmlElement
	private SMDetailCode detailCode;
	
	@XmlElement
	private String userId;
	
	public String getAppointmentRequestDetailCodeId() {
		return appointmentRequestDetailCodeId;
	}

	public void setAppointmentRequestDetailCodeId(String appointmentRequestDetailCodeId) {
		this.appointmentRequestDetailCodeId = appointmentRequestDetailCodeId;
	}
	
	public Date getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public SMDetailCode getDetailCode() {
		return detailCode;
	}

	public void setDetailCode(SMDetailCode detailCode) {
		this.detailCode = detailCode;
	}

	@Override
	public int compareTo(SMAppointmentRequestDetailCode that) {
		int result = 0;
		
		if (this.getCreatedDate().before(that.getCreatedDate())) {
			result = 1;
		} else if (this.getCreatedDate().before(that.getCreatedDate())) {
			result = -1;
		}
		
		return result;
	}
}
