Source: models/certificationrenewalWithoutRequiredConstraint.js

/**
 * certificationrenewal-without-required-constraint Model
 * Generated: 2025-04-01T19:44:53.347Z
 */

/**
 * certificationrenewal-without-required-constraint model class
 */
export class CertificationrenewalWithoutRequiredConstraint {
  /**
   * Create a new certificationrenewal-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 of renewal (e.g., "interim", "directors", "technical")
     * @type string
     */
    this.renewalType = data.renewalType !== undefined ? data.renewalType : undefined;
    /**
     * Date when renewal is due (Unix milliseconds)
     * @type number
     */
    this.dueDate = data.dueDate !== undefined ? data.dueDate : undefined;
    /**
     * Whether this renewal has been completed
     * @type boolean
     */
    this.completed = data.completed !== undefined ? data.completed : undefined;
    /**
     * Date when renewal was completed (Unix milliseconds)
     * @type number
     */
    this.completedDate = data.completedDate !== undefined ? data.completedDate : undefined;
    /**
     * Additional notes about this renewal
     * @type string
     */
    this.notes = data.notes !== undefined ? data.notes : undefined;
    /**
     * The certification this renewal is associated with 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.renewalType !== undefined) {
      data.renewalType = this.renewalType;
    }
    if (this.dueDate !== undefined) {
      data.dueDate = this.dueDate;
    }
    if (this.completed !== undefined) {
      data.completed = this.completed;
    }
    if (this.completedDate !== undefined) {
      data.completedDate = this.completedDate;
    }
    if (this.notes !== undefined) {
      data.notes = this.notes;
    }
    if (this.certification !== undefined) {
      data.certification = this.certification;
    }

    return data;
  }

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

export default CertificationrenewalWithoutRequiredConstraint;