Source: models/personWithoutRequiredConstraint.js

/**
 * person-without-required-constraint Model
 * Generated: 2025-04-01T19:44:53.356Z
 */

/**
 * person-without-required-constraint model class
 */
export class PersonWithoutRequiredConstraint {
  /**
   * Create a new person-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.firstName = data.firstName !== undefined ? data.firstName : undefined;
    /**
     * Professional or honorific title
     * @type string
     */
    this.title = data.title !== undefined ? data.title : undefined;
    /**
     * Person's gender
     * @type string
     */
    this.gender = data.gender !== undefined ? data.gender : undefined;
    /**
     * 
     * @type string
     */
    this.lastName = data.lastName !== undefined ? data.lastName : undefined;
    /**
     * 
     * @type string
     */
    this.email = data.email !== undefined ? data.email : undefined;
    /**
     * 
     * @type string
     */
    this.phone = data.phone !== undefined ? data.phone : undefined;
    /**
     * Italian Fiscal Code (Codice Fiscale)
     * @type string
     */
    this.taxCode = data.taxCode !== undefined ? data.taxCode : undefined;
    /**
     * Date of birth (Unix milliseconds)
     * @type number
     */
    this.birthDate = data.birthDate !== undefined ? data.birthDate : undefined;
    /**
     * Place of birth (city)
     * @type string
     */
    this.birthPlace = data.birthPlace !== undefined ? data.birthPlace : undefined;
    /**
     * Province of birth (2-letter code)
     * @type string
     */
    this.birthProvince = data.birthProvince !== undefined ? data.birthProvince : undefined;
    /**
     * Residential address
     * @type string
     */
    this.address = data.address !== undefined ? data.address : undefined;
    /**
     * City of residence
     * @type string
     */
    this.city = data.city !== undefined ? data.city : undefined;
    /**
     * Province of residence (2-letter code)
     * @type string
     */
    this.province = data.province !== undefined ? data.province : undefined;
    /**
     * Postal code
     * @type string
     */
    this.postalCode = data.postalCode !== undefined ? data.postalCode : undefined;
    /**
     * Italian Certified Email Address (PEC)
     * @type string
     */
    this.certifiedEmail = data.certifiedEmail !== undefined ? data.certifiedEmail : undefined;
    /**
     * 
     * @type string
     */
    this.authId = data.authId !== undefined ? data.authId : undefined;
    /**
     * Array of **personcompanyrole**'s or array of FK's when creating / updating / not populated
     * @type personcompanyrole[]
     */
    this.companyRoles = data.companyRoles !== undefined ? data.companyRoles : undefined;
    /**
     * Array of **professionalcertification**'s or array of FK's when creating / updating / not populated
     * @type professionalcertification[]
     */
    this.certifications = data.certifications !== undefined ? data.certifications : 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.firstName !== undefined) {
      data.firstName = this.firstName;
    }
    if (this.title !== undefined) {
      data.title = this.title;
    }
    if (this.gender !== undefined) {
      data.gender = this.gender;
    }
    if (this.lastName !== undefined) {
      data.lastName = this.lastName;
    }
    if (this.email !== undefined) {
      data.email = this.email;
    }
    if (this.phone !== undefined) {
      data.phone = this.phone;
    }
    if (this.taxCode !== undefined) {
      data.taxCode = this.taxCode;
    }
    if (this.birthDate !== undefined) {
      data.birthDate = this.birthDate;
    }
    if (this.birthPlace !== undefined) {
      data.birthPlace = this.birthPlace;
    }
    if (this.birthProvince !== undefined) {
      data.birthProvince = this.birthProvince;
    }
    if (this.address !== undefined) {
      data.address = this.address;
    }
    if (this.city !== undefined) {
      data.city = this.city;
    }
    if (this.province !== undefined) {
      data.province = this.province;
    }
    if (this.postalCode !== undefined) {
      data.postalCode = this.postalCode;
    }
    if (this.certifiedEmail !== undefined) {
      data.certifiedEmail = this.certifiedEmail;
    }
    if (this.authId !== undefined) {
      data.authId = this.authId;
    }
    if (this.companyRoles !== undefined) {
      data.companyRoles = this.companyRoles;
    }
    if (this.certifications !== undefined) {
      data.certifications = this.certifications;
    }

    return data;
  }

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

export default PersonWithoutRequiredConstraint;