﻿var Promotion = (function() {
    function fnPromotionConstructor(iNewId, sNewName, sNewDescription, dNewStartDate, dNewEndDate, bNewIsPercentage, fNewAmount) {
        /****************************************************/
        /*                                                  */
        /*                                                  */
        /*           Class Level Private Variables          */
        /*                                                  */
        /*                                                  */
        /****************************************************/

        var oInstance;

        var iId;
        var sName;
        var sDescription;
        var dStartDate;
        var dEndDate;
        var bIsPercentage;
        var fAmount;

        /****************************************************/
        /*                                                  */
        /*                                                  */
        /*                Accessors/Mutators                */
        /*                                                  */
        /*                                                  */
        /****************************************************/

        this.getId = function() {
            return iId;
        }

        this.setId = function(iNewId) {
            iId = iNewId;
        }

        this.getName = function() {
            return sName;
        }

        this.setName = function(sNewName) {
            sName = sNewName;
        }

        this.getDescription = function() {
            return sDescription;
        }

        this.setDescription = function(sNewDescription) {
            sDescription = sNewDescription;
        }

        this.getStartDate = function() {
            return dStartDate;
        }

        this.setStartDate = function(dNewStartDate) {
            dStartDate = dNewStartDate;
        }

        this.getEndDate = function() {
            return dEndDate;
        }

        this.setEndDate = function(dNewEndDate) {
            dEndDate = dNewEndDate;
        }

        this.getIsPercentage = function() {
            return bIsPercentage;
        }

        this.setIsPercentage = function(bNewIsPercentage) {
            bIsPercentage = bNewIsPercentage;
        }

        this.getAmount = function() {
            return fAmount;
        }

        this.setAmount = function(fNewAmount) {
            fAmount = fNewAmount;
        }

        /****************************************************/
        /*                                                  */
        /*                                                  */
        /*                Cloneable Interface               */
        /*                                                  */
        /*                                                  */
        /****************************************************/

        this.clone = function() {
            return new Promotion(this.getId(), this.getName(), this.getDescription(), this.getStartDate(), this.getEndDate(), this.getIsPercentage(), this.getAmount());
        }

        /****************************************************/
        /*                                                  */
        /*                                                  */
        /*                 Initialize Class                 */
        /*                                                  */
        /*                                                  */
        /****************************************************/

        oInstance = this;

        this.setId(iNewId);
        this.setName(sNewName);
        this.setDescription(sNewDescription);
        this.setStartDate(dNewStartDate);
        this.setEndDate(dNewEndDate);
        this.setIsPercentage(bNewIsPercentage);
        this.setAmount(fNewAmount);
    }

    return fnPromotionConstructor;
})();