|
| 1 | +/** |
| 2 | + * HelloAsso API |
| 3 | + * HelloAsso auto-generated SDK |
| 4 | + * |
| 5 | + * The version of the OpenAPI document: public |
| 6 | + * |
| 7 | + * |
| 8 | + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 9 | + * https://openapi-generator.tech |
| 10 | + * Do not edit the class manually. |
| 11 | + * |
| 12 | + */ |
| 13 | + |
| 14 | +import ApiClient from '../ApiClient'; |
| 15 | +import HelloAssoApiV5ModelsFormsCustomFieldPublicModel from './HelloAssoApiV5ModelsFormsCustomFieldPublicModel'; |
| 16 | + |
| 17 | +/** |
| 18 | + * The HelloAssoApiV5ModelsFormsExtraOptionPublicModel model module. |
| 19 | + * @module model/HelloAssoApiV5ModelsFormsExtraOptionPublicModel |
| 20 | + * @version public |
| 21 | + */ |
| 22 | +class HelloAssoApiV5ModelsFormsExtraOptionPublicModel { |
| 23 | + /** |
| 24 | + * Constructs a new <code>HelloAssoApiV5ModelsFormsExtraOptionPublicModel</code>. |
| 25 | + * ExtraOptionFullModel |
| 26 | + * @alias module:model/HelloAssoApiV5ModelsFormsExtraOptionPublicModel |
| 27 | + */ |
| 28 | + constructor() { |
| 29 | + |
| 30 | + HelloAssoApiV5ModelsFormsExtraOptionPublicModel.initialize(this); |
| 31 | + } |
| 32 | + |
| 33 | + /** |
| 34 | + * Initializes the fields of this object. |
| 35 | + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). |
| 36 | + * Only for internal use. |
| 37 | + */ |
| 38 | + static initialize(obj) { |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * Constructs a <code>HelloAssoApiV5ModelsFormsExtraOptionPublicModel</code> from a plain JavaScript object, optionally creating a new instance. |
| 43 | + * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. |
| 44 | + * @param {Object} data The plain JavaScript object bearing properties of interest. |
| 45 | + * @param {module:model/HelloAssoApiV5ModelsFormsExtraOptionPublicModel} obj Optional instance to populate. |
| 46 | + * @return {module:model/HelloAssoApiV5ModelsFormsExtraOptionPublicModel} The populated <code>HelloAssoApiV5ModelsFormsExtraOptionPublicModel</code> instance. |
| 47 | + */ |
| 48 | + static constructFromObject(data, obj) { |
| 49 | + if (data) { |
| 50 | + obj = obj || new HelloAssoApiV5ModelsFormsExtraOptionPublicModel(); |
| 51 | + |
| 52 | + if (data.hasOwnProperty('customFields')) { |
| 53 | + obj['customFields'] = ApiClient.convertToType(data['customFields'], [HelloAssoApiV5ModelsFormsCustomFieldPublicModel]); |
| 54 | + } |
| 55 | + if (data.hasOwnProperty('id')) { |
| 56 | + obj['id'] = ApiClient.convertToType(data['id'], 'Number'); |
| 57 | + } |
| 58 | + if (data.hasOwnProperty('price')) { |
| 59 | + obj['price'] = ApiClient.convertToType(data['price'], 'Number'); |
| 60 | + } |
| 61 | + if (data.hasOwnProperty('vatRate')) { |
| 62 | + obj['vatRate'] = ApiClient.convertToType(data['vatRate'], 'Number'); |
| 63 | + } |
| 64 | + if (data.hasOwnProperty('label')) { |
| 65 | + obj['label'] = ApiClient.convertToType(data['label'], 'String'); |
| 66 | + } |
| 67 | + if (data.hasOwnProperty('description')) { |
| 68 | + obj['description'] = ApiClient.convertToType(data['description'], 'String'); |
| 69 | + } |
| 70 | + if (data.hasOwnProperty('isRequired')) { |
| 71 | + obj['isRequired'] = ApiClient.convertToType(data['isRequired'], 'Boolean'); |
| 72 | + } |
| 73 | + } |
| 74 | + return obj; |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * Validates the JSON data with respect to <code>HelloAssoApiV5ModelsFormsExtraOptionPublicModel</code>. |
| 79 | + * @param {Object} data The plain JavaScript object bearing properties of interest. |
| 80 | + * @return {boolean} to indicate whether the JSON data is valid with respect to <code>HelloAssoApiV5ModelsFormsExtraOptionPublicModel</code>. |
| 81 | + */ |
| 82 | + static validateJSON(data) { |
| 83 | + if (data['customFields']) { // data not null |
| 84 | + // ensure the json data is an array |
| 85 | + if (!Array.isArray(data['customFields'])) { |
| 86 | + throw new Error("Expected the field `customFields` to be an array in the JSON data but got " + data['customFields']); |
| 87 | + } |
| 88 | + // validate the optional field `customFields` (array) |
| 89 | + for (const item of data['customFields']) { |
| 90 | + HelloAssoApiV5ModelsFormsCustomFieldPublicModel.validateJSON(item); |
| 91 | + }; |
| 92 | + } |
| 93 | + // ensure the json data is a string |
| 94 | + if (data['label'] && !(typeof data['label'] === 'string' || data['label'] instanceof String)) { |
| 95 | + throw new Error("Expected the field `label` to be a primitive type in the JSON string but got " + data['label']); |
| 96 | + } |
| 97 | + // ensure the json data is a string |
| 98 | + if (data['description'] && !(typeof data['description'] === 'string' || data['description'] instanceof String)) { |
| 99 | + throw new Error("Expected the field `description` to be a primitive type in the JSON string but got " + data['description']); |
| 100 | + } |
| 101 | + |
| 102 | + return true; |
| 103 | + } |
| 104 | + |
| 105 | + |
| 106 | +} |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +/** |
| 111 | + * List of custom fields to be filled by the user |
| 112 | + * @member {Array.<module:model/HelloAssoApiV5ModelsFormsCustomFieldPublicModel>} customFields |
| 113 | + */ |
| 114 | +HelloAssoApiV5ModelsFormsExtraOptionPublicModel.prototype['customFields'] = undefined; |
| 115 | + |
| 116 | +/** |
| 117 | + * Id |
| 118 | + * @member {Number} id |
| 119 | + */ |
| 120 | +HelloAssoApiV5ModelsFormsExtraOptionPublicModel.prototype['id'] = undefined; |
| 121 | + |
| 122 | +/** |
| 123 | + * Price of the extraOption, can be free |
| 124 | + * @member {Number} price |
| 125 | + */ |
| 126 | +HelloAssoApiV5ModelsFormsExtraOptionPublicModel.prototype['price'] = undefined; |
| 127 | + |
| 128 | +/** |
| 129 | + * Vat rate if applicable Amount have to be 0.10 for 10% |
| 130 | + * @member {Number} vatRate |
| 131 | + */ |
| 132 | +HelloAssoApiV5ModelsFormsExtraOptionPublicModel.prototype['vatRate'] = undefined; |
| 133 | + |
| 134 | +/** |
| 135 | + * The name of the option |
| 136 | + * @member {String} label |
| 137 | + */ |
| 138 | +HelloAssoApiV5ModelsFormsExtraOptionPublicModel.prototype['label'] = undefined; |
| 139 | + |
| 140 | +/** |
| 141 | + * The description of the option |
| 142 | + * @member {String} description |
| 143 | + */ |
| 144 | +HelloAssoApiV5ModelsFormsExtraOptionPublicModel.prototype['description'] = undefined; |
| 145 | + |
| 146 | +/** |
| 147 | + * Additional option is required/mandatory |
| 148 | + * @member {Boolean} isRequired |
| 149 | + */ |
| 150 | +HelloAssoApiV5ModelsFormsExtraOptionPublicModel.prototype['isRequired'] = undefined; |
| 151 | + |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | + |
| 156 | + |
| 157 | +export default HelloAssoApiV5ModelsFormsExtraOptionPublicModel; |
| 158 | + |
0 commit comments