1 /**
  2  * @fileOverview JavaScript representation of the Finesse TeamAssignment object.
  3  *
  4  * @name finesse.restservices.TeamAssignment
  5  * @requires finesse.clientservices.ClientServices
  6  * @requires Class
  7  * @requires finesse.FinesseBase
  8  * @requires finesse.restservices.RestBase
  9  */
 10 
 11 var finesse = finesse || {};
 12 finesse.restservices = finesse.restservices || {};
 13 
 14 /** @private */
 15 finesse.restservices.TeamAssignment = finesse.restservices.RestBase.extend(/** @lends finesse.restservices.TeamAssignment.prototype */{
 16 
 17     _notReadyReasonCodes: null,
 18     _signOutReasonCodes: null,
 19     _wrapUpReasons: null,
 20 
 21     /**
 22      * @class
 23      * JavaScript representation of a TeamAssignment object. Also exposes
 24      * methods to operate on the object against the server.
 25      *
 26      * @param {Object} options
 27      *     An object with the following properties:<ul>
 28      *         <li><b>id:</b> The id of the object being constructed</li>
 29      *         <li><b>onLoad(this): (optional)</b> when the object is successfully loaded from the server</li>
 30      *         <li><b>onChange(this): (optional)</b> when an update notification of the object is received</li>
 31      *         <li><b>onAdd(this): (optional)</b> when a notification that the object is created is received</li>
 32      *         <li><b>onDelete(this): (optional)</b> when a notification that the object is deleted is received</li>
 33      *         <li><b>onError(rsp): (optional)</b> if loading of the object fails, invoked with the error response object:<ul>
 34      *             <li><b>status:</b> {Number} The HTTP status code returned</li>
 35      *             <li><b>content:</b> {String} Raw string of response</li>
 36      *             <li><b>object:</b> {Object} Parsed object of response</li>
 37      *             <li><b>error:</b> {Object} Wrapped exception that was caught:<ul>
 38      *                 <li><b>errorType:</b> {String} Type of error that was caught</li>
 39      *                 <li><b>errorMessage:</b> {String} Message associated with error</li>
 40      *             </ul></li>
 41      *         </ul></li>
 42      *         <li><b>parentObj: (optional)</b> The parent object</li></ul>
 43      * @constructs finesse.restservices.TeamAssignment
 44      **/
 45     init: function (options) {
 46         this._super(options);
 47     },
 48 		
 49     /**
 50      * @private
 51      * Gets the REST class for the current object - this is the TeamAssignment class.
 52      * @returns {Object} The TeamAssignment class.
 53      */
 54 	getRestClass: function () {
 55 		return finesse.restservices.TeamAssignment;
 56 	},
 57 
 58     /**
 59      * @private
 60      * Gets the REST type for the current object - this is a "TeamAssignment".
 61      * @returns {String} The Team string.
 62      */
 63 	getRestType : function () {
 64 		return "Team";
 65 	},
 66 	
 67     /**
 68      * @private
 69      * Override default to indicate that this object doesn't support making
 70      * requests.
 71      */
 72     supportsRequests: false,
 73 
 74     /**
 75      * @private
 76      * Override default to indicate that this object doesn't support subscriptions.
 77      */
 78     supportsSubscriptions: false,
 79 
 80     /**
 81      * Getter for the name.
 82      * @returns {String} The name.
 83      */
 84     getName: function () {
 85         this.isLoaded();
 86         return this.getData().name;
 87     },
 88 
 89     /**
 90      * Getter for the uri.
 91      * @returns {String} The uri.
 92      */
 93     getUri: function () {
 94         this.isLoaded();
 95         return this.getData().uri;
 96     },
 97 
 98     /**
 99      * Getter for the id.
100      * @returns {String} The id.
101      */
102     getId: function () {
103         this.isLoaded();
104         return this.getData().id;
105     },
106 
107     /**
108      * Getter for a NotReadyReasonCodes collection object that is associated with a Team.
109      * @param callbacks
110      * @returns {ReasonCodes}
111      *     A Not Ready Reason Codes collection object.
112      */
113     getNotReadyReasonCodes: function (callbacks) {
114         var options = callbacks || {};
115         options.parentObj = this;
116         this.isLoaded();
117 
118         if (this._notReadyReasonCodes === null) {
119             this._notReadyReasonCodes = new finesse.restservices.ReasonCodes(options);
120         }
121 
122         return this._notReadyReasonCodes;
123     },
124 
125     /**
126      * Getter for a SignOutReasonCodes collection object that is associated with a Team.
127      * @param callbacks
128      * @returns {ReasonCodes}
129      *     A Sign Out Reason Codes collection object.
130      */
131     getSignOutReasonCodes: function (callbacks) {
132         var options = callbacks || {};
133         options.parentObj = this;
134         this.isLoaded();
135 
136         if (this._signOutReasonCodes === null) {
137             this._signOutReasonCodes = new finesse.restservices.ReasonCodes(options);
138         }
139 
140         return this._signOutReasonCodes;
141     },
142 
143     /**
144      * Getter for a WrapUpReasons collection object that is associated with a Team.
145      * @param callbacks
146      * @returns {WrapUpReasons}
147      *     A Wrap-Up Reasons collection object.
148      */
149     getWrapUpReasons: function (callbacks) {
150         var options = callbacks || {};
151         options.parentObj = this;
152         this.isLoaded();
153 
154         if (this._wrapUpReasons === null) {
155             this._wrapUpReasons = new finesse.restservices.WrapUpReasons(options);
156         }
157 
158         return this._wrapUpReasons;
159     }
160 });
161