Source: models/certificationcategoryassignmentWithoutRequiredConstraint.js

/**
 * certificationcategoryassignment-without-required-constraint Model
 * Generated: 2025-04-01T19:44:53.345Z
 */

/**
 * certificationcategoryassignment-without-required-constraint model class
 */
export class CertificationcategoryassignmentWithoutRequiredConstraint {
  /**
   * Create a new certificationcategoryassignment-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;
    /**
     * Date when this category was added to certification (Unix milliseconds)
     * @type number
     */
    this.issueDate = data.issueDate !== undefined ? data.issueDate : undefined;
    /**
     * Category-specific expiration date if applicable (Unix milliseconds)
     * @type number
     */
    this.expiryDate = data.expiryDate !== undefined ? data.expiryDate : undefined;
    /**
     * Optional notes about this category assignment
     * @type string
     */
    this.notes = data.notes !== undefined ? data.notes : undefined;
    /**
     * The certification this assignment belongs to JSON dictionary representing the **certification** instance or FK when creating / updating / not populated
     * @type any
     */
    this.certification = data.certification !== undefined ? data.certification : undefined;
    /**
     * The category assigned to the certification JSON dictionary representing the **certificationcategory** instance or FK when creating / updating / not populated
     * @type any
     */
    this.category = data.category !== undefined ? data.category : undefined;
    /**
     * The classification level for this category assignment JSON dictionary representing the **classificationlevel** instance or FK when creating / updating / not populated
     * @type any
     */
    this.level = data.level !== undefined ? data.level : 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.issueDate !== undefined) {
      data.issueDate = this.issueDate;
    }
    if (this.expiryDate !== undefined) {
      data.expiryDate = this.expiryDate;
    }
    if (this.notes !== undefined) {
      data.notes = this.notes;
    }
    if (this.certification !== undefined) {
      data.certification = this.certification;
    }
    if (this.category !== undefined) {
      data.category = this.category;
    }
    if (this.level !== undefined) {
      data.level = this.level;
    }

    return data;
  }

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

export default CertificationcategoryassignmentWithoutRequiredConstraint;