/*
Copyright (c) 2007 Matt Williams matt@milliams.com

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License or (at
your option) version 3 or, at the discretion of KDE e.V. (which shall
act as a proxy as in section 14 of the GPLv3), any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef KQTIASSESSMENTITEMREF_H
#define KQTIASSESSMENTITEMREF_H

#include <kqti_export.h>

#include "kqtisectionpart.h"

#include <QDomElement>
#include <QMap>
#include <QMetaType>

class KQtiSectionPart;
class KQtiAssessmentItem;

/**
 * \class KQtiAssessmentItemRef
 * Items are incorporated into the test by reference and not by direct
 * aggregation. Note that the identifier of the reference need not have any
 * meaning outside the test. In particular it is not required to be unique in
 * the context of any catalog, or be represented in the item's meta-data. The
 * syntax of this identifier is more restrictive than that of the identifier
 * attribute of the assessmentItem itself.
 * 
 * http://www.imsglobal.org/question/qtiv2p1pd2/imsqti_infov2p1pd2.html#element10519
 */

class KQTI_EXPORT KQtiAssessmentItemRef : public KQtiSectionPart
{
    public:
        KQtiAssessmentItemRef(const QString& identifier, const QString& href);
        KQtiAssessmentItemRef(const QDomElement& element);
        KQtiAssessmentItemRef() {/*Hopefully this isn't used*/}
        ~KQtiAssessmentItemRef();
        
        void setHref(const QString& href) {mHref = href;}
        QString href() const {return mHref;}
        
        ///@param item the KQtiAssessmentItem that this object is refering to
        void setItem(KQtiAssessmentItem* item) {mItem = item;}
        ///@return the KQtiAssessmentItem that this object is refering to
        KQtiAssessmentItem* item() const {return mItem;}
        
        ///@return create and return the DOM element
        QDomElement element() const;
        
    protected:
        QString mHref;
        KQtiAssessmentItem* mItem;
};

Q_DECLARE_METATYPE(KQtiAssessmentItemRef*)

#endif
