Source: models/headquarterWithoutRequiredConstraint.js

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

/**
 * headquarter-without-required-constraint model class
 */
export class HeadquarterWithoutRequiredConstraint {
  /**
   * Create a new headquarter-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.address = data.address !== undefined ? data.address : undefined;
    /**
     * 
     * @type string
     */
    this.city = data.city !== undefined ? data.city : undefined;
    /**
     * 
     * @type string
     */
    this.country = data.country !== undefined ? data.country : undefined;
    /**
     * 
     * @type string
     */
    this.postalCode = data.postalCode !== undefined ? data.postalCode : undefined;
    /**
     * Headquarter office number
     * @type string
     */
    this.phone = data.phone !== undefined ? data.phone : undefined;
    /**
     * 
     * @type string
     */
    this.state = data.state !== undefined ? data.state : undefined;
    /**
     * 
     * @type boolean
     */
    this.isLegal = data.isLegal !== undefined ? data.isLegal : undefined;
    /**
     * 
     * @type boolean
     */
    this.shipping = data.shipping !== undefined ? data.shipping : undefined;
    /**
     * Headquarter notes
     * @type string
     */
    this.description = data.description !== undefined ? data.description : undefined;
    /**
     * JSON dictionary representing the **company** instance or FK when creating / updating / not populated
     * @type any
     */
    this.company = data.company !== undefined ? data.company : 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.address !== undefined) {
      data.address = this.address;
    }
    if (this.city !== undefined) {
      data.city = this.city;
    }
    if (this.country !== undefined) {
      data.country = this.country;
    }
    if (this.postalCode !== undefined) {
      data.postalCode = this.postalCode;
    }
    if (this.phone !== undefined) {
      data.phone = this.phone;
    }
    if (this.state !== undefined) {
      data.state = this.state;
    }
    if (this.isLegal !== undefined) {
      data.isLegal = this.isLegal;
    }
    if (this.shipping !== undefined) {
      data.shipping = this.shipping;
    }
    if (this.description !== undefined) {
      data.description = this.description;
    }
    if (this.company !== undefined) {
      data.company = this.company;
    }

    return data;
  }

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

export default HeadquarterWithoutRequiredConstraint;