package meerkat.voting.gui.managment;

import meerkat.protobuf.BallotQuestionUiElement;

import java.util.List;

/**
 * Created by Vladimir Eliezer Tokarev on 10/5/2016.
 * This class contains the voters selection in different panel
 * those items are:
 * 1. the channel of the voter
 * 2. the name of the person the voter selected
 * 3. the ByteString (that contains bytes of image) of the person the voter selected
 */
public class VotersBallot {
    public List<Integer> VoterChannel;
    public String VotersNameSelection;
    public BallotQuestionUiElement.UIAnswer VotersImageSelection;

    /**
     * Gets the name of the candidate the voter choose
     * @return String
     */
    public String GetCandidateName(){
        if (this.VotersImageSelection == null || this.VotersImageSelection.getDescription() == null ){
            return null;
        }
        String[] name = this.VotersImageSelection.getDescription().split(" ");
        return name[0] + " " + name[1];
    }

    public String toString(){
        return this.VotersNameSelection +"---"+ this.VoterChannel.get(0) + "" +  this.VoterChannel.get(1) +
                this.VoterChannel.get(2) + "" + this.VoterChannel.get(3);
    }
}
