package de.stoermer.xxx.domain;

import java.util.Objects;

public class Toy {

	private String id;
	private String beschreibung;

	public String getBeschreibung() {
		return beschreibung;
	}

	public void setBeschreibung(String beschreibung) {
		this.beschreibung = beschreibung;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public static Toy fromXml(de.stoermer.xxx.domain.xml.Toy xml) {
		Toy toy = new Toy();
		toy.setId(xml.getId());
		toy.setBeschreibung(xml.getName());
		return toy;
	}
	
	@Override
	public int hashCode() {
		return Objects.hash(id);
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Toy other = (Toy) obj;
		return Objects.equals(id, other.id);
	}

}
