Source: models/certificationWithoutRequiredConstraint.js

/**
 * certification-without-required-constraint Model
 * Generated: 2025-04-01T19:44:53.343Z
 */

/**
 * certification-without-required-constraint model class
 */
export class CertificationWithoutRequiredConstraint {
  /**
   * Create a new certification-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;
    /**
     * Official certificate number (null until issued)
     * @type string
     */
    this.number = data.number !== undefined ? data.number : undefined;
    /**
     * Current status of the certification
     * @type string
     */
    this.status = data.status !== undefined ? data.status : undefined;
    /**
     * Date when the certificate was issued (Unix milliseconds)
     * @type number
     */
    this.issueDate = data.issueDate !== undefined ? data.issueDate : undefined;
    /**
     * Main expiration date for the certification (Unix milliseconds)
     * @type number
     */
    this.expiryDate = data.expiryDate !== undefined ? data.expiryDate : undefined;
    /**
     * Optional notes or description
     * @type string
     */
    this.description = data.description !== undefined ? data.description : undefined;
    /**
     * 
     * @type number
     */
    this.amount = data.amount !== undefined ? data.amount : undefined;
    /**
     * The company this certification belongs to JSON dictionary representing the **company** instance or FK when creating / updating / not populated
     * @type any
     */
    this.company = data.company !== undefined ? data.company : undefined;
    /**
     * The case associated with this certification process JSON dictionary representing the **case** instance or FK when creating / updating / not populated
     * @type any
     */
    this.case = data.case !== undefined ? data.case : undefined;
    /**
     * The type of certification JSON dictionary representing the **certificationtype** instance or FK when creating / updating / not populated
     * @type any
     */
    this.type = data.type !== undefined ? data.type : undefined;
    /**
     * The provider/authority issuing this certification JSON dictionary representing the **certificationprovider** instance or FK when creating / updating / not populated
     * @type any
     */
    this.provider = data.provider !== undefined ? data.provider : undefined;
    /**
     * Array of **certificationmeta**'s or array of FK's when creating / updating / not populated
     * @type certificationmeta[]
     */
    this.metaFields = data.metaFields !== undefined ? data.metaFields : undefined;
    /**
     * Array of **certificationcategoryassignment**'s or array of FK's when creating / updating / not populated
     * @type certificationcategoryassignment[]
     */
    this.categoryAssignments = data.categoryAssignments !== undefined ? data.categoryAssignments : undefined;
    /**
     * Array of **certificationrenewal**'s or array of FK's when creating / updating / not populated
     * @type certificationrenewal[]
     */
    this.renewals = data.renewals !== undefined ? data.renewals : 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.number !== undefined) {
      data.number = this.number;
    }
    if (this.status !== undefined) {
      data.status = this.status;
    }
    if (this.issueDate !== undefined) {
      data.issueDate = this.issueDate;
    }
    if (this.expiryDate !== undefined) {
      data.expiryDate = this.expiryDate;
    }
    if (this.description !== undefined) {
      data.description = this.description;
    }
    if (this.amount !== undefined) {
      data.amount = this.amount;
    }
    if (this.company !== undefined) {
      data.company = this.company;
    }
    if (this.case !== undefined) {
      data.case = this.case;
    }
    if (this.type !== undefined) {
      data.type = this.type;
    }
    if (this.provider !== undefined) {
      data.provider = this.provider;
    }
    if (this.metaFields !== undefined) {
      data.metaFields = this.metaFields;
    }
    if (this.categoryAssignments !== undefined) {
      data.categoryAssignments = this.categoryAssignments;
    }
    if (this.renewals !== undefined) {
      data.renewals = this.renewals;
    }

    return data;
  }

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

export default CertificationWithoutRequiredConstraint;