package github.pasiahopelto.scorelib.model;

import java.io.Serializable;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

public class Vote implements Serializable {
	
	private static final long serialVersionUID = 1L;

	private String votingName;
	private String candidateName;
	private String optionName;
	
	public String getVotingName() {
		return votingName;
	}
	
	public void setVotingName(String votingName) {
		this.votingName = votingName;
	}

	public String getCandidateName() {
		return candidateName;
	}

	public void setCandidateName(String candidateName) {
		this.candidateName = candidateName;
	}

	public String getOptionName() {
		return optionName;
	}

	public void setOptionName(String optionName) {
		this.optionName = optionName;
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder().append(votingName).append(candidateName).append(optionName).toHashCode();
	}

	@Override
	public boolean equals(Object obj) {
		boolean result = false;
		if(obj instanceof Vote) {
			Vote other = (Vote) obj;
			result = new EqualsBuilder().append(other.votingName, votingName).append(other.candidateName, candidateName).append(other.optionName, optionName).isEquals();
		}
		return result;
	}
}

@@ -365,16 +365,70 @@
 onName;%0A
+%09private Voting voting;%0A%09private Candidate candidate;%0A
 %09%0A%09publi
@@ -862,24 +862,142 @@
 onName;%0A%09%7D%0A%0A
+%09public Voting getVoting() %7B%0A%09%09return voting;%0A%09%7D%0A%0A%09public void setVoting(Voting voting) %7B%0A%09%09this.voting = voting;%0A%09%7D%0A%0A
 %09@Override%0A%09
@@ -1111,16 +1111,49 @@
 onName).
+append(voting).append(candidate).
 toHashCo
@@ -1441,16 +1441,80 @@
 onName).
+append(other.voting, voting).append(other.candidate, candidate).
 isEquals

add voting and candidate to voting