Manual Reference Source Test

src/models/navigation/AppMenu.js

/**
 * Model representing app menu. A app menu redirects the user to different screens and
 * sections of the application.
 */
class AppMenuModel {
  /**
   * @param {!Object} [response]              - JSON formatted response of a single menu
   * @param {Number}  response.id             - The id of the app menu
   * @param {String}  response.title          - The title of the app menu
   * @param {String}  response.action         - The action that the devices need to execute when the app menu is tapped.
   *                                            Options are:
   *                                            - about_us
   *                                            - alerts
   *                                            - appointments
   *                                            - ar
   *                                            - arts
   *                                            - badges
   *                                            - brands
   *                                            - breath_assessment
   *                                            - calendar
   *                                            - captured_value_groups
   *                                            - care_circle
   *                                            - companion
   *                                            - companions
   *                                            - comply_scan
   *                                            - contact
   *                                            - container
   *                                            - cost_calculator
   *                                            - data_collection
   *                                            - diamond_club
   *                                            - dynamic_contents
   *                                            - ediary
   *                                            - email
   *                                            - event_report
   *                                            - events
   *                                            - external_url
   *                                            - faq
   *                                            - favorites
   *                                            - flow_process
   *                                            - galleries
   *                                            - give_points
   *                                            - glossary
   *                                            - health_measurements
   *                                            - home
   *                                            - information
   *                                            - key_terms
   *                                            - logout
   *                                            - map
   *                                            - menu
   *                                            - my_trial
   *                                            - news
   *                                            - no_action
   *                                            - offers
   *                                            - outage_map
   *                                            - pain_assessment
   *                                            - payment_locator
   *                                            - personal_center
   *                                            - places
   *                                            - privacy_policy
   *                                            - profile
   *                                            - push_notification
   *                                            - reminders
   *                                            - report_an_outage
   *                                            - rewards
   *                                            - scavenger
   *                                            - send_message
   *                                            - settings
   *                                            - share
   *                                            - social
   *                                            - static_screen
   *                                            - subcategory
   *                                            - tagged_contents
   *                                            - technical_support
   *                                            - terms
   *                                            - tou
   *                                            - tracker
   *                                            - trial
   *                                            - unknown
   *                                            - url
   *                                            - video
   *                                            - video_consult
   *                                            - videos
   * @param {Object}  response.image            - The icon of the app menu
   * @param {Boolean} response.enabled          - true,
   * @param {String}  response.created_at       - '2018-03-20T15:46:33Z',
   * @param {String}  response.updated_at       - '2018-03-20T15:46:33Z',
   * @param {Number}  response.position         - 1

   */
  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);
    }

    if (attributes.image && attributes.image.image) {
      /** @type {Object} */
      this.image = attributes.image.image;
    }

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

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

    /** @type {Boolean} */
    this.enabled = attributes.enabled;

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

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

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

export default AppMenuModel;