Manual Reference Source Test

src/models/agreement/AgreementTemplate.js

/**
 * Model representing an Agreement Template.
 *
 */
class AgreementTemplateModel {
  /**
   * @param {Object} response                           - JSON formatted response of an agreement
   * @param {Number} response.id                        - The id of the agreement template
   * @param {String} response.redirect_url              - The agreement template redirect url
   * @param {String} response.template_name             - The agreement template name
   * @param {String} response.description               - The description of the agreement template
   * @param {String} response.message                   - Agreement template message
   * @param {String} response.created_at                - Date when the agreement template was created
   * @param {String} response.updated_at                - Date when the agreement template was last updated
   * @param {String} response.permanent_link            - Permanent link of the agreement template
   * @param {String} response.reminder_frequency        - Reminder frequency of the agreement template
   * @param {String} response.archived_at               - Date when the agreement template was archived
   * @param {Number} response.expiration                - Number of days till expiration of the agreement template
   * @param {Boolean} response.approval_required        - Flag for approval requirement
   */
  constructor(response = {}) {
    const _response = response.data || response; // if json api is passed in directly
    const attributes = _response.attributes || _response; // if json api is passed in directly

    if (_response.id) {
      /** @type {Number} */
      this.id = parseInt(_response.id, 10);
    }

    /** @type {String} */
    this.templateName = attributes.template_name;

    /** @type {String} */
    this.description = attributes.description;

    /** @type {String} */
    this.documentUrl = attributes.document_url;

    /** @type {Number} */
    this.expiration = attributes.expiration;

    /** @type {String} */
    this.message = attributes.message;

    /** @type {String} */
    this.redirectUrl = attributes.redirect_url;

    /** @type {String} */
    this.createdAt = attributes.created_at;

    /** @type {String} */
    this.updatedAt = attributes.updated_at;

    /** @type {String} */
    this.permanentLink = attributes.permanent_link;

    /** @type {String} */
    this.reminderFrequency = attributes.reminder_frequency;

    /** @type {String} */
    this.archivedAt = attributes.archived_at;
  }
}

export default AgreementTemplateModel;