src/models/flow/FlowInput.js
/**
* Model representing a flow input in a flow process.
*/
class FlowInputModel {
/**
* @param {Object} response - JSON formatted response of a flow input
* @param {String} response.attribute - Attribute doesn't seem to be used
* @param {Number} response.body - Other section that may have instructions
* @param {Array} response.choice_list - An array of inputs available to the user
* @param {String} response.code - Code to help for code found in validation expressions
* @param {Number} response.id - The id of the flow input
* @param {String} response.instructions - Instructions for the specific input
* @param {Array} response.locked - Whether or not the response is read only
* @param {String} response.min_label - Min Label for a slider
* @param {Number} response.min - Min value for a slider or numeric input
* @param {String} response.max_label - Max Label for a slider
* @param {Number} response.max - Max value for a slider or numeric input
* @param {String} response.question_type - Question Type that explain how to answer the
* flow input. Options are: input,
* single_choice, multiple_choice,
* pre_populated, search, search_and_upload,
* autocomplete, date, numeric, time,
* file_upload, rank_order
* @param {Boolean} response.required - Whether or not the field is required
* @param {String} response.storage_attribute - Storage Attribute (used for removing files)
* @param {String} response.style - Style that explain how to answer the flow
* input. Options are: email, state,
* phone_number, irb, site_address, attribute,
* phone, email, role, last_name, first_name,
* prefix, dropdown, radio_buttons, calendar,
* slider, spinner, text_area, zipcode, json,
* text, checkboxes, list_box, range,
* physician, study_coordinator, search,
* inline, request_by_email, license,
* medical_board, cv, certificate,
* normal_values, staff_members, hidden, and
* any project custom styles
* @param {String} response.title - The title of the flow input
* @param {Object} response.validation_details - Any further validation information
* @param {String} response.validation_expression - The regex for validation
*/
constructor(response = {}) {
/** @type {String} */
this.attribute = response.attribute;
/** @type {Number} */
this.body = response.body;
/** @type {Array} */
this.choice_list = response.choice_list;
/** @type {String} */
this.code = response.code;
/** @type {Number} */
this.id = response.id;
/** @type {String} */
this.instructions = response.instructions;
/** @type {Array} */
this.locked = response.locked;
/** @type {String} */
this.minLabel = response.min_label;
/** @type {Number} */
this.min = response.min;
/** @type {String} */
this.maxLabel = response.max_label;
/** @type {Number} */
this.max = response.max;
/** @type {String} */
this.question_type = response.question_type;
/** @type {Boolean} */
this.required = response.required;
/** @type {String} */
this.storage_attribute = response.storage_attribute;
/** @type {String} */
this.style = response.style;
/** @type {String} */
this.title = response.title;
/**
* @type {Object}
* @property {Object|String} validation_details.min A string date, "current" or an object with
* details
* @property {String} validation_details.min.value A string date or "current"
* @property {Object} validation_details.min.add
* @property {Number} validation_details.min.add.day Number of days added to min value
* @property {Number} validation_details.min.add.month Number of months added to min value
* @property {Number} validation_details.min.add.year Number of years added to min value
* @property {Object} validation_details.min.subtract
* @property {Number} validation_details.min.subtract.day Number of days subtracted from min
* value
* @property {Number} validation_details.min.subtract.month Number of months subtracted from
* min value
* @property {Number} validation_details.min.subtract.year Number of years subtracted from min
* value
* @property {Object|String} validation_details.max A string date, "current" or an object with
* details
* @property {String} validation_details.max.value A string date or "current"
* @property {Object} validation_details.max.add
* @property {Number} validation_details.max.add.day Number of days added to max value
* @property {Number} validation_details.max.add.month Number of months added to max value
* @property {Number} validation_details.max.add.year Number of years added to max value
* @property {Object} validation_details.max.subtract
* @property {Number} validation_details.max.subtract.day Number of days subtracted from max
* value
* @property {Number} validation_details.max.subtract.month Number of months subtracted from
* max value
* @property {Number} validation_details.max.subtract.year Number of years subtracted from max
* value
*/
this.validation_details = response.validation_details;
/** @type {String} */
this.validation_expression = response.validation_expression;
}
}
export default FlowInputModel;