Source: models/companyWithoutRequiredConstraint.js

/**
 * company-without-required-constraint Model
 * Generated: 2025-04-01T19:44:53.349Z
 */

/**
 * company-without-required-constraint model class
 */
export class CompanyWithoutRequiredConstraint {
  /**
   * Create a new company-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.vat = data.vat !== undefined ? data.vat : undefined;
    /**
     * Italian fiscal code for companies
     * @type string
     */
    this.taxCode = data.taxCode !== undefined ? data.taxCode : undefined;
    /**
     * 
     * @type string
     */
    this.description = data.description !== undefined ? data.description : undefined;
    /**
     * Legal form of the company (e.g., Srl, SpA)
     * @type string
     */
    this.legalForm = data.legalForm !== undefined ? data.legalForm : undefined;
    /**
     * Date when the company was founded (Unix milliseconds)
     * @type number
     */
    this.incorporationDate = data.incorporationDate !== undefined ? data.incorporationDate : undefined;
    /**
     * Company share capital in euros
     * @type number
     */
    this.shareCapital = data.shareCapital !== undefined ? data.shareCapital : undefined;
    /**
     * Italian Business Registry registration number
     * @type string
     */
    this.businessRegistryNumber = data.businessRegistryNumber !== undefined ? data.businessRegistryNumber : undefined;
    /**
     * Economic Administrative Index (R.E.A.) number
     * @type string
     */
    this.reaNumber = data.reaNumber !== undefined ? data.reaNumber : undefined;
    /**
     * Date of registration in the Business Registry (Unix milliseconds)
     * @type number
     */
    this.registrationDate = data.registrationDate !== undefined ? data.registrationDate : undefined;
    /**
     * Italian Certified Email Address (PEC)
     * @type string
     */
    this.certifiedEmail = data.certifiedEmail !== undefined ? data.certifiedEmail : undefined;
    /**
     * Email Address
     * @type string
     */
    this.email = data.email !== undefined ? data.email : undefined;
    /**
     * 
     * @type string
     */
    this.phone = data.phone !== undefined ? data.phone : undefined;
    /**
     * 
     * @type string
     */
    this.url = data.url !== undefined ? data.url : undefined;
    /**
     * How the company was acquired
     * @type string
     */
    this.acquisitionSource = data.acquisitionSource !== undefined ? data.acquisitionSource : undefined;
    /**
     * Date when the company became a client (Unix milliseconds)
     * @type number
     */
    this.acquisitionDate = data.acquisitionDate !== undefined ? data.acquisitionDate : undefined;
    /**
     * Sistema di Interscambio (SDI) code for electronic invoicing
     * @type string
     */
    this.sdi = data.sdi !== undefined ? data.sdi : undefined;
    /**
     * Registration number in the Artisan Companies Registry (Albo delle Imprese Artigiane)
     * @type string
     */
    this.artisanRegistryNumber = data.artisanRegistryNumber !== undefined ? data.artisanRegistryNumber : undefined;
    /**
     * Date of registration in the Artisan Companies Registry (Unix milliseconds)
     * @type number
     */
    this.artisanRegistrationDate = data.artisanRegistrationDate !== undefined ? data.artisanRegistrationDate : undefined;
    /**
     * Array of **headquarter**'s or array of FK's when creating / updating / not populated
     * @type headquarter[]
     */
    this.headquarters = data.headquarters !== undefined ? data.headquarters : undefined;
    /**
     * Array of **quotation**'s or array of FK's when creating / updating / not populated
     * @type quotation[]
     */
    this.quotations = data.quotations !== undefined ? data.quotations : undefined;
    /**
     * JSON dictionary representing the **documentrequest** instance or FK when creating / updating / not populated
     * @type any
     */
    this.documentRequest = data.documentRequest !== undefined ? data.documentRequest : undefined;
    /**
     * Array of **personcompanyrole**'s or array of FK's when creating / updating / not populated
     * @type personcompanyrole[]
     */
    this.people = data.people !== undefined ? data.people : undefined;
    /**
     * Array of **case**'s or array of FK's when creating / updating / not populated
     * @type case[]
     */
    this.cases = data.cases !== undefined ? data.cases : 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.vat !== undefined) {
      data.vat = this.vat;
    }
    if (this.taxCode !== undefined) {
      data.taxCode = this.taxCode;
    }
    if (this.description !== undefined) {
      data.description = this.description;
    }
    if (this.legalForm !== undefined) {
      data.legalForm = this.legalForm;
    }
    if (this.incorporationDate !== undefined) {
      data.incorporationDate = this.incorporationDate;
    }
    if (this.shareCapital !== undefined) {
      data.shareCapital = this.shareCapital;
    }
    if (this.businessRegistryNumber !== undefined) {
      data.businessRegistryNumber = this.businessRegistryNumber;
    }
    if (this.reaNumber !== undefined) {
      data.reaNumber = this.reaNumber;
    }
    if (this.registrationDate !== undefined) {
      data.registrationDate = this.registrationDate;
    }
    if (this.certifiedEmail !== undefined) {
      data.certifiedEmail = this.certifiedEmail;
    }
    if (this.email !== undefined) {
      data.email = this.email;
    }
    if (this.phone !== undefined) {
      data.phone = this.phone;
    }
    if (this.url !== undefined) {
      data.url = this.url;
    }
    if (this.acquisitionSource !== undefined) {
      data.acquisitionSource = this.acquisitionSource;
    }
    if (this.acquisitionDate !== undefined) {
      data.acquisitionDate = this.acquisitionDate;
    }
    if (this.sdi !== undefined) {
      data.sdi = this.sdi;
    }
    if (this.artisanRegistryNumber !== undefined) {
      data.artisanRegistryNumber = this.artisanRegistryNumber;
    }
    if (this.artisanRegistrationDate !== undefined) {
      data.artisanRegistrationDate = this.artisanRegistrationDate;
    }
    if (this.headquarters !== undefined) {
      data.headquarters = this.headquarters;
    }
    if (this.quotations !== undefined) {
      data.quotations = this.quotations;
    }
    if (this.documentRequest !== undefined) {
      data.documentRequest = this.documentRequest;
    }
    if (this.people !== undefined) {
      data.people = this.people;
    }
    if (this.cases !== undefined) {
      data.cases = this.cases;
    }

    return data;
  }

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

export default CompanyWithoutRequiredConstraint;