// com.tts.initial.html5.quiz.ddsource.autoform
define( function() {

    "use strict";

    function QuizState( dropSourceStore ) {

        var states = {
                Undefined : "undefined",
                TestRun: "test_run",
                UserSolution: "user_solution",
                BestPracticeSolution: "best_practice_solution"
            },
            currentState = states.Undefined,
            previousState = states.Undefined;

        function setState( newState ){
            previousState = currentState;
            currentState = newState;
            dropSourceStore.setQuizState( currentState );
        }

        return {
            changeToTestRun : function(){
                setState( states.TestRun );
            },
            wasChangingFromTestRun : function(){
                return previousState === states.TestRun;
            },
            changeToUserSolution : function(){
                setState(  states.UserSolution );
            },
            changeToBestPracticeSolution : function(){
                setState( states.BestPracticeSolution );
            },
            restore : function(){
                currentState = dropSourceStore.getQuizState();
            }
        };
    }
    return QuizState;
});
