/*
 * Copyright (c) 2005 Absolutely Training Limited
 *  
 * Created on 07-Feb-2005
 */

 // constructor

function Learner_preference(){
	this.audio_level;
	this.language;
	this.delivery_speed;
	this.audio_captioning;
	this._children="audio_level,language,delivery_speed,audio_captioning";
        
        this.type="learner_preference";

        this.propertiesArray = new Array("audio_level", "language", "delivery_speed", "audio_captioning");
	this.validator = new Validator();
	
}

// create and discard an initial Object to force the prototype object to be
// created in Navigator 3.

new Learner_preference(); 
Learner_preference.prototype = new RTEDataObject();
Learner_preference.prototype.constructor = Learner_preference;

    /**
     * @param audio_captioning The audio_captioning to set.
     */
   Learner_preference.prototype.setAudio_captioning =  function(audio_captioning) {
        if (this.validator.listContainsState(this.validator.LEARNER_PREFERENCE_AUDIO_CAPTIONING_LIST, audio_captioning)) {
            this.audio_captioning = audio_captioning;
		    return VariableInfo.NO_SET_ERROR;
       } else{
        	return VariableInfo.ERROR_406;
       }
    };

    /**
     * @param audio_level The audio_level to set.
     */
    Learner_preference.prototype.setAudio_level = function(audio_level){
	    if (!this.validator.validateReal(audio_level)){
		    return VariableInfo.ERROR_406;
	    } else if (this.validator.validateRange(audio_level, "1.0", "*")){
		    this.audio_level = audio_level;
		    return VariableInfo.NO_SET_ERROR;
	    } else{
		   return VariableInfo.ERROR_407;
	    }
    };

    /**
     * @param delivery_speed The delivery_speed to set.
     */
    Learner_preference.prototype.setDelivery_speed = function(delivery_speed) {
        // TODO it should validate whether the number is greater than 1
        this.validator.validateReal(delivery_speed);
        this.delivery_speed = delivery_speed;
		return VariableInfo.NO_SET_ERROR;
    };

    /**
     * @param language The language to set.
     */
    Learner_preference.prototype.setLanguage = function(language){

	    if (this.validator.validateLocale(language)){
		    this.language = language;
		    return VariableInfo.NO_SET_ERROR;
	    }else{
		    return VariableInfo.ERROR_406;
	    }
    };
  	


