﻿// Copyright 2007. Adobe Systems Incorporated. All Rights Reserved.
package com.adobe.captivate.events 
{
	import flash.events.Event;
	import com.adobe.captivate.enums.CPQuestionScoringTypeEnum;

	/**
	* The CPQuestionEventData class describes the data that is passed when a question is submitted
	 */
	public class CPQuestionEventData
	{
		/**
		 * @private
		*/
		protected var m_SlideNumber:Number;
		/**
		 * @private
		*/
		protected var m_QuestionNumber:Number;
		/**
		 * @private
		*/
		protected var m_QuestionScoringType:CPQuestionScoringTypeEnum;
		/**
		 * @private
		*/
		protected var m_QuestionType:String;
		/**
		 * @private
		*/
		protected var m_QuestionAnswered:Boolean;
		/**
		 * @private
		*/
		protected var m_QuestionAnsweredCorrectly:Boolean;
		/**
		 * @private
		*/
		protected var m_QuestionMaxScore:Number;
		/**
		 * @private
		*/
		protected var m_QuestionScore:Number;
		/**
		 * @private
		*/
		protected var m_QuestionMaxAttempts:Number;
		/**
		 * @private
		*/
		protected var m_QuestionAttempts:Number;
		/**
		 * @private
		*/
		protected var m_InteractionID:String;
		/**
		 * @private
		*/
		protected var m_QuizName:String;
		/**
		 * @private
		*/
		protected var m_ObjectiveID:String;
		/**
		 * @private
		*/
		protected var m_SelectedAnswer:String;

		/**
		 * @private
		*/
		protected var m_CorrectAnswer:String;
		/**
		 * @private
		*/
		protected var m_ReportAnswers:Boolean;

		public function CPQuestionEventData(slideNumber:Number,questionNumber:Number,questionScoringType:CPQuestionScoringTypeEnum,questionType:String,
		questionAnswered:Boolean,questionAnsweredCorrectly:Boolean,questionMaxScore:Number,questionScore:Number,questionMaxAttempts:Number,questionAttempts:Number,interactionID:String,
		quizName:String,objectiveID:String,selectedAnswer:String,correctAnswer:String,reportAnswers:Boolean)
		{
			m_SlideNumber = slideNumber;
			m_QuestionScoringType = questionScoringType;
			m_QuestionNumber = questionNumber;
			m_QuestionType = questionType;
			m_QuestionAnswered = questionAnswered;
			m_QuestionAnsweredCorrectly = questionAnsweredCorrectly;
			m_QuestionMaxScore = questionMaxScore;
			m_QuestionScore = questionScore;
			m_QuestionMaxAttempts = questionMaxAttempts;
			m_QuestionAttempts = questionAttempts;
			m_InteractionID = interactionID;
			m_QuizName = quizName;
			m_ObjectiveID = objectiveID;
			m_SelectedAnswer = selectedAnswer;
			m_CorrectAnswer = correctAnswer;
			m_ReportAnswers = reportAnswers;
		}
		/**
		 * This property indicates the slide upon which the quesion is present
		*/
		public function get slideNumber():Number
		{
			return m_SlideNumber;
		}
		/**
		 * This property indicates the question number of the question
		*/
		public function get questionNumber():Number
		{
			return m_QuestionNumber;
		}
		/**
		 * This property indicates the scoring type of the question
		 * @see com.adobe.captivate.enums.CPQuestionScoringTypeEnum	
		*/
		public function get questionScoringType():CPQuestionScoringTypeEnum
		{
			return m_QuestionScoringType;
		}
		/**
		 * This property indicates the type of the question as String. Has one of the values - true-false,choice,likert,fill-in,long-fill-in,matching,sequencing,widget
		*/
		public function get questionType():String
		{
			return m_QuestionType;
		}
		/**
		 * This property indicates <code>true</code> if the question was answered <code>false</code> otherwise
		*/
		public function get questionAnswered():Boolean
		{
			return m_QuestionAnswered;
		}
		/**
		 * This property indicates <code>true</code> if the question was answered correctly <code>false</code> otherwise
		*/
		public function get questionAnsweredCorrectly():Boolean
		{
			return m_QuestionAnsweredCorrectly;
		}
		/**
		 * This property indicates the max points that can be scored by answering this question
		*/
		public function get questionMaxScore():Number
		{
			return m_QuestionMaxScore;
		}
		/**
		 * This property indicates the  points that scored by answering this question
		*/
		public function get questionScore():Number
		{
			return m_QuestionScore;
		}
		/**
		 * This property indicates the max number of times the question can be attempted. returns -1 if the number of attempts is infiniteAttempts
		 * @see #infiniteAttempts
		*/
		public function get questionMaxAttempts():Number
		{
			return m_QuestionMaxAttempts;
		}
		/**
		 * This property indicates the number of attempts in which the question was answered
		*/
		public function get questionAttempts():Number
		{
			return m_QuestionAttempts;
		}
		/**
		 * This property indicates the interaction id of the question
		*/
		public function get interactionID():String
		{
			return m_InteractionID;
		}
		/**
		 * This property indicates the name of the quiz to which the question belongs to
		*/
		public function get quizName():String
		{
			return m_QuizName;
		}
		/**
		 * This property indicates the objective id of the question
		*/
		public function get objectiveID():String
		{
			return m_ObjectiveID;
		}
		public function get reportAnswers():Boolean
		{
			return m_ReportAnswers;
		}
		/**
		 * This property indicates whether the question has inifnite attempts
		 * @return  <code>true</code> if the question has infinite attempts<code>false</code> otherwise
		*/
		public function get	infiniteAttempts():Boolean
		{
			return (questionMaxAttempts == -1);
		}
		/**
		 * This property returns the answers selected by the user.
		 The format of the answer is
		 MultipleChoice - A,B
		True,False - True/False
		Hot Spot - X,Y key value pairs seperated by comma (,)
		Sequence - Answered Sequence Text seperated by comma(,)
		Matching - Colon Matched Items and answers seperated by comma (,)
		FIB,Short Answer - Answered Text
		Likert - Selected Radio Button Text
		*/
		public function get selectedAnswer():String
		{
			return m_SelectedAnswer;
		}

		public function get correctAnswer():String
		{
			return m_CorrectAnswer;
		}
		/*
		* @private
		*/
		public function toString():String
		{
			return ("[CPQuestionEventData slideNumber="+slideNumber+" questionNumber="+questionNumber+" questionScoringType="+questionScoringType+" questionType="+
			questionType+" questionAnswered="+questionAnswered+" questionAnsweredCorrectly="+questionAnsweredCorrectly+" questionMaxScore="+questionMaxScore+" questionScore="+questionScore+
			" infiniteAttempts="+infiniteAttempts+" questionMaxAttempts="+questionMaxAttempts+" questionAttempts="+questionAttempts+" interactionID="+interactionID+" quizName="+quizName+
			" objectiveID="+objectiveID+ " selectedAnswer="+selectedAnswer + " reportAnswers="+reportAnswers+"]");
		}
	}
}
