Source: models/certificationmetaWithoutRequiredConstraint.js

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

/**
 * certificationmeta-without-required-constraint model class
 */
export class CertificationmetaWithoutRequiredConstraint {
  /**
   * Create a new certificationmeta-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;
    /**
     * Metadata key (e.g., "contractDate", "soaCode", "revisionExpiry")
     * @type string
     */
    this.key = data.key !== undefined ? data.key : undefined;
    /**
     * Metadata value stored as text, can be parsed based on valueType
     * @type string
     */
    this.value = data.value !== undefined ? data.value : undefined;
    /**
     * The data type of the value for proper parsing and validation
     * @type string
     */
    this.valueType = data.valueType !== undefined ? data.valueType : undefined;
    /**
     * Optional description of this metadata field
     * @type string
     */
    this.description = data.description !== undefined ? data.description : undefined;
    /**
     * The certification this metadata 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;
  }

  /**
   * 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.key !== undefined) {
      data.key = this.key;
    }
    if (this.value !== undefined) {
      data.value = this.value;
    }
    if (this.valueType !== undefined) {
      data.valueType = this.valueType;
    }
    if (this.description !== undefined) {
      data.description = this.description;
    }
    if (this.certification !== undefined) {
      data.certification = this.certification;
    }

    return data;
  }

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

export default CertificationmetaWithoutRequiredConstraint;