Source: models/classificationlevelWithoutRequiredConstraint.js

/**
 * classificationlevel-without-required-constraint Model
 * Generated: 2025-04-01T19:44:53.349Z
 */

/**
 * classificationlevel-without-required-constraint model class
 */
export class ClassificationlevelWithoutRequiredConstraint {
  /**
   * Create a new classificationlevel-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;
    /**
     * Unique identifier for the classification level
     * @type string
     */
    this.code = data.code !== undefined ? data.code : undefined;
    /**
     * Display name of the classification level
     * @type string
     */
    this.name = data.name !== undefined ? data.name : undefined;
    /**
     * Detailed description of the classification level
     * @type string
     */
    this.description = data.description !== undefined ? data.description : undefined;
    /**
     * Numerical/ordinal value for sorting and comparison
     * @type number
     */
    this.value = data.value !== undefined ? data.value : undefined;
    /**
     * The certification type this classification level belongs to (optional) JSON dictionary representing the **certificationtype** instance or FK when creating / updating / not populated
     * @type any
     */
    this.type = data.type !== undefined ? data.type : undefined;
    /**
     * Array of **certificationcategoryassignment**'s or array of FK's when creating / updating / not populated
     * @type certificationcategoryassignment[]
     */
    this.assignments = data.assignments !== undefined ? data.assignments : 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.code !== undefined) {
      data.code = this.code;
    }
    if (this.name !== undefined) {
      data.name = this.name;
    }
    if (this.description !== undefined) {
      data.description = this.description;
    }
    if (this.value !== undefined) {
      data.value = this.value;
    }
    if (this.type !== undefined) {
      data.type = this.type;
    }
    if (this.assignments !== undefined) {
      data.assignments = this.assignments;
    }

    return data;
  }

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

export default ClassificationlevelWithoutRequiredConstraint;