package com.agilex.healthcare.schedulingmanager.domain;

import com.agilex.healthcare.mobilehealthplatform.domain.DataIdentifier;
import com.agilex.healthcare.mobilehealthplatform.domain.DomainTransferObject;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlAccessorType(value = XmlAccessType.NONE)
@XmlRootElement(name = "specialty", namespace = Namespace.SchedulingManager)
public class SchedulingSpecialty extends DomainTransferObject {

    private static final long serialVersionUID = -8638544418773401093L;

    @XmlElement
    private String name;

    @XmlElement
    private SchedulingClinics specialtyClinics;

	@XmlElement
	private DataIdentifier dataIdentifier;
	
	public SchedulingSpecialty(){}
	public SchedulingSpecialty(String specialtyUniqueId){
		this.setUniqueId(specialtyUniqueId);
	}
	
    public String getName() {
        return name;
    }

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

    public SchedulingClinics getSpecialtyClinics() {
        return specialtyClinics;
    }

    public void setSpecialtyClinics(SchedulingClinics specialtyClinics) {
        this.specialtyClinics = specialtyClinics;
    }
    
	public void setDataIdentifier(DataIdentifier dataIdentifier) {
		this.dataIdentifier = dataIdentifier;
	}

	public DataIdentifier getDataIdentifier() {
		if (dataIdentifier == null){
	        dataIdentifier = new DataIdentifier();
		}
		return dataIdentifier;
	}
	
	public void setUniqueId(String uniqueId) {
		getDataIdentifier().setUniqueId(uniqueId);
	}

	public String getUniqueId() {
		return getDataIdentifier().getUniqueId();
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SchedulingSpecialty other = (SchedulingSpecialty) obj;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
	
	
	
}
