Source: models/caseWithoutRequiredConstraint.js

/**
 * case-without-required-constraint Model
 * Generated: 2025-04-01T19:44:53.342Z
 */

/**
 * case-without-required-constraint model class
 */
export class CaseWithoutRequiredConstraint {
  /**
   * Create a new case-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 certification case
     * @type string
     */
    this.number = data.number !== undefined ? data.number : undefined;
    /**
     * 
     * @type string
     */
    this.description = data.description !== undefined ? data.description : undefined;
    /**
     * 
     * @type string
     */
    this.status = data.status !== undefined ? data.status : undefined;
    /**
     * 
     * @type number
     */
    this.startDate = data.startDate !== undefined ? data.startDate : undefined;
    /**
     * 
     * @type number
     */
    this.estimatedCompletionDate = data.estimatedCompletionDate !== undefined ? data.estimatedCompletionDate : undefined;
    /**
     * 
     * @type number
     */
    this.completionDate = data.completionDate !== undefined ? data.completionDate : undefined;
    /**
     * 
     * @type string
     */
    this.priority = data.priority !== undefined ? data.priority : undefined;
    /**
     * JSON dictionary representing the **company** instance or FK when creating / updating / not populated
     * @type any
     */
    this.company = data.company !== undefined ? data.company : undefined;
    /**
     * JSON dictionary representing the **documentrequest** instance or FK when creating / updating / not populated
     * @type any
     */
    this.documentRequest = data.documentRequest !== undefined ? data.documentRequest : undefined;
    /**
     * JSON dictionary representing the **quotation** instance or FK when creating / updating / not populated
     * @type any
     */
    this.quotation = data.quotation !== undefined ? data.quotation : undefined;
    /**
     * Array of **certification**'s or array of FK's when creating / updating / not populated
     * @type certification[]
     */
    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.number !== undefined) {
      data.number = this.number;
    }
    if (this.description !== undefined) {
      data.description = this.description;
    }
    if (this.status !== undefined) {
      data.status = this.status;
    }
    if (this.startDate !== undefined) {
      data.startDate = this.startDate;
    }
    if (this.estimatedCompletionDate !== undefined) {
      data.estimatedCompletionDate = this.estimatedCompletionDate;
    }
    if (this.completionDate !== undefined) {
      data.completionDate = this.completionDate;
    }
    if (this.priority !== undefined) {
      data.priority = this.priority;
    }
    if (this.company !== undefined) {
      data.company = this.company;
    }
    if (this.documentRequest !== undefined) {
      data.documentRequest = this.documentRequest;
    }
    if (this.quotation !== undefined) {
      data.quotation = this.quotation;
    }
    if (this.certification !== undefined) {
      data.certification = this.certification;
    }

    return data;
  }

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

export default CaseWithoutRequiredConstraint;