Source: models/fileWithoutRequiredConstraint.js

/**
 * file-without-required-constraint Model
 * Generated: 2025-04-01T19:44:53.354Z
 */

/**
 * file-without-required-constraint model class
 */
export class FileWithoutRequiredConstraint {
  /**
   * Create a new file-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 string
     */
    this.name = data.name !== undefined ? data.name : undefined;
    /**
     * 
     * @type string
     */
    this.version = data.version !== undefined ? data.version : undefined;
    /**
     * 
     * @type number
     */
    this.year = data.year !== undefined ? data.year : undefined;
    /**
     * 
     * @type string
     */
    this.path = data.path !== undefined ? data.path : undefined;
    /**
     * 
     * @type number
     */
    this.fileSize = data.fileSize !== undefined ? data.fileSize : undefined;
    /**
     * The MIME type of the file (e.g., "application/pdf", "image/jpeg")
     * @type string
     */
    this.mimeType = data.mimeType !== undefined ? data.mimeType : undefined;
    /**
     * JSON dictionary representing the **documentsubmission** instance or FK when creating / updating / not populated
     * @type any
     */
    this.documentSubmission = data.documentSubmission !== undefined ? data.documentSubmission : 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.name !== undefined) {
      data.name = this.name;
    }
    if (this.version !== undefined) {
      data.version = this.version;
    }
    if (this.year !== undefined) {
      data.year = this.year;
    }
    if (this.path !== undefined) {
      data.path = this.path;
    }
    if (this.fileSize !== undefined) {
      data.fileSize = this.fileSize;
    }
    if (this.mimeType !== undefined) {
      data.mimeType = this.mimeType;
    }
    if (this.documentSubmission !== undefined) {
      data.documentSubmission = this.documentSubmission;
    }

    return data;
  }

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

export default FileWithoutRequiredConstraint;