let vcGameRound = Vue.component('game-round', {
    template: `
        <section class="game-round component center">

            <count-down :description="'Starting in...'" :seconds="5" @callback="startRound()" key="game-round-timer" v-if="!started"></count-down>
            <count-down :description="'Time left...'" :seconds="roundDuration" @callback="stopRound()" key="game-round-timer2" v-if="started"></count-down>

            <section v-if="started">
                <h2>Prompt: {{ round.prompt.Title }}</h2>
                <label>
                    <span>Guess a movie</span>
                    <input v-model="searchTerm" @keyup="makeSuggestions()" @keyup.enter="makeGuess()" />
                </label>
                <div class="suggestions" v-if="suggestions && suggestions.length">
                    <div class="suggestion" v-for="(suggestion, index) in suggestions" @click="makeGuess(suggestion)">
                        {{ suggestion.Title }}
                    </div>
                </div>
                <div v-for="player in round.players">
                    <div v-for="guess in player.guesses">
                        {{ guess.Title }}
                    </div>
                </div>
            </section>

        </section>
    `,
    props: ['gameId'],
    data: function(){
        return {
            round: {},
            roundDuration: 0,
            started: false,
            searchTerm: "",
            suggestions: []
        }
    },
    mounted: function(){
        firebaseData.games.child(`${this.gameId}/details/roundDuration`).once("value", (data)=>{
            this.roundDuration = data.val();
        });
        this.roundRef = firebaseData.games.child(`${this.gameId}/rounds/current`);
        this.roundRef.on("value", (data)=>{
            this.round = data.val();
        });
    },
    methods: {
        startRound(){
            this.started = true;
        },
        stopRound(){
            this.$emit("finished");
        },
        makeSuggestions(){
            movieData.search(this.searchTerm).then((res)=>{
                this.suggestions = res.Search;
            });
        },
        makeGuess(guess){
            if(!guess) guess = this.suggestions[0];
            if(!guess) throw `Invalid movie selection!`;
            movieData.get(guess.imdbID).then((movie)=>{
                this.roundRef
                    .child(`players/${user.uid}/guesses/${movie.imdbID}`)
                    .set(movie);
                this.searchTerm = "";
                this.suggestions = [];
            });
        }
    }
});
@@ -1121,16 +1121,58 @@
 guesses%22
+ :class=%22%7B duplicate: guess.isDuplicate %7D%22
 %3E%0A      
@@ -1505,16 +1505,44 @@
 ions: %5B%5D
+,%0A            guessedIds: %7B%7D
 %0A       
@@ -1886,32 +1886,386 @@
 d = data.val();%0A
+            let players = this.round.current.players;%0A            Object.keys(players).forEach((pKey)=%3E%7B%0A                let guesses = players%5BpKey%5D.guesses;%0A                Object.keys(guesses).forEach((gKey)=%3E%7B%0A                    let guess = guesses%5BgKey%5D;%0A                    this.guessedIds%5Bguess.imdbID%5D = true;%0A                %7D);%0A            %7D);%0A
         %7D);%0A    
@@ -2595,21 +2595,21 @@
 keGuess(
-guess
+movie
 )%7B%0A     
@@ -2623,20 +2623,20 @@
 if(!
-guess) guess
+movie) movie
  = t
@@ -2671,21 +2671,21 @@
     if(!
-guess
+movie
 ) throw 
@@ -2738,21 +2738,21 @@
 ata.get(
-guess
+movie
 .imdbID)
@@ -2762,18 +2762,133 @@
 en((
-movie
+guess
 )=%3E%7B%0A
+                if(this.guessedIds%5Bguess.imdbID%5D)%7B%0A                    guess.isDuplicate = true;%0A                %7D%0A
     
@@ -2971,21 +2971,21 @@
 esses/$%7B
-movie
+guess
 .imdbID%7D
@@ -3012,21 +3012,21 @@
    .set(
-movie
+guess
 );%0A     

duplicate guesses