Source: models/documentrequestWithoutRequiredConstraint.js

/**
 * documentrequest-without-required-constraint Model
 * Generated: 2025-04-01T19:44:53.351Z
 */

/**
 * documentrequest-without-required-constraint model class
 */
export class DocumentrequestWithoutRequiredConstraint {
  /**
   * Create a new documentrequest-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.status = data.status !== undefined ? data.status : undefined;
    /**
     * 
     * @type number
     */
    this.deadline = data.deadline !== undefined ? data.deadline : undefined;
    /**
     * 
     * @type boolean
     */
    this.notify = data.notify !== undefined ? data.notify : undefined;
    /**
     * Array of **company**'s or array of FK's when creating / updating / not populated
     * @type company[]
     */
    this.company = data.company !== undefined ? data.company : undefined;
    /**
     * Array of **documentrequestitem**'s or array of FK's when creating / updating / not populated
     * @type documentrequestitem[]
     */
    this.requiredDocuments = data.requiredDocuments !== undefined ? data.requiredDocuments : 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.status !== undefined) {
      data.status = this.status;
    }
    if (this.deadline !== undefined) {
      data.deadline = this.deadline;
    }
    if (this.notify !== undefined) {
      data.notify = this.notify;
    }
    if (this.company !== undefined) {
      data.company = this.company;
    }
    if (this.requiredDocuments !== undefined) {
      data.requiredDocuments = this.requiredDocuments;
    }

    return data;
  }

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

export default DocumentrequestWithoutRequiredConstraint;