Source: models/quotationitemWithoutRequiredConstraint.js

/**
 * quotationitem-without-required-constraint Model
 * Generated: 2025-04-01T19:44:53.359Z
 */

/**
 * quotationitem-without-required-constraint model class
 */
export class QuotationitemWithoutRequiredConstraint {
  /**
   * Create a new quotationitem-without-required-constraint instance
   * @param {Object} data - Initial data
   */
  constructor(data = {}) {
    /**
     * Note Sails special attributes: autoIncrement
     * @type integer
     */
    this.id = data.id !== undefined ? data.id : undefined;
    /**
     * 
     * @type number
     */
    this.createdAt = data.createdAt !== undefined ? data.createdAt : undefined;
    /**
     * 
     * @type number
     */
    this.updatedAt = data.updatedAt !== undefined ? data.updatedAt : undefined;
    /**
     * The user who created this record JSON dictionary representing the **person** instance or FK when creating / updating / not populated
     * @type any
     */
    this.createdBy = data.createdBy !== undefined ? data.createdBy : undefined;
    /**
     * 
     * @type string
     */
    this.description = data.description !== undefined ? data.description : undefined;
    /**
     * 
     * @type number
     */
    this.amount = data.amount !== undefined ? data.amount : undefined;
    /**
     * JSON dictionary representing the **quotation** instance or FK when creating / updating / not populated
     * @type any
     */
    this.quotation = data.quotation !== undefined ? data.quotation : undefined;
  }

  /**
   * Validate the model
   * @returns {Object} - Validation result {valid: boolean, errors: Object}
   */
  validate() {
    const errors = {};


    return {
      valid: Object.keys(errors).length === 0,
      errors
    };
  }

  /**
   * Convert the model to a plain object
   * @returns {Object} - Plain object representation
   */
  toJSON() {
    const data = {};

    if (this.id !== undefined) {
      data.id = this.id;
    }
    if (this.createdAt !== undefined) {
      data.createdAt = this.createdAt;
    }
    if (this.updatedAt !== undefined) {
      data.updatedAt = this.updatedAt;
    }
    if (this.createdBy !== undefined) {
      data.createdBy = this.createdBy;
    }
    if (this.description !== undefined) {
      data.description = this.description;
    }
    if (this.amount !== undefined) {
      data.amount = this.amount;
    }
    if (this.quotation !== undefined) {
      data.quotation = this.quotation;
    }

    return data;
  }

  /**
   * Create a quotationitem-without-required-constraint instance from JSON data
   * @param {Object} data - JSON data
   * @returns QuotationitemWithoutRequiredConstraint - New model instance
   */
  static fromJSON(data) {
    return new QuotationitemWithoutRequiredConstraint(data);
  }
}

export default QuotationitemWithoutRequiredConstraint;