package com.agilex.healthcare.schedulingmanager.datalayer.appointment;

import com.agilex.healthcare.schedulingmanager.datalayer.PersistenceObject;
import com.agilex.healthcare.schedulingmanager.datalayer.Transformable;
import com.agilex.healthcare.schedulingmanager.domain.SMAppointmentMetric;
import com.thoughtworks.xstream.annotations.XStreamAlias;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "APPOINTMENT_METRICS")
@XStreamAlias("SMAppointmentMetric")
public class AppointmentMetricPo extends PersistenceObject implements Transformable<SMAppointmentMetric> {

	private static final long serialVersionUID = 8705978416581705866L;
	
	private String name;
	private int value;
	
	public AppointmentMetricPo() {
	}
	
	public AppointmentMetricPo(SMAppointmentMetric dto) {
		setName(dto.getName());
		setValue(dto.getValue());
	}
	
	@Id
	@Column(name = "NAME")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "VALUE")
	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}

	@Override
	public SMAppointmentMetric create() {
		SMAppointmentMetric dto = new SMAppointmentMetric();
		dto.setName(getName());
		dto.setValue(getValue());
		
		return dto;
	}
}
