<commit_before>import { AMaaSModel } from '../../core'
import { Address, Email } from '../Children'

import { retrieveData } from '../../utils/network'

/**
 * Class representing a Party
 * @extends AMaaSModel
 */
class Party extends AMaaSModel {
  /**
   * Construct a new Party object
   * @param {object} params - Party creation options
   * @param {number} params.assetManagerId - Asset Manager ID of the Party
   * @param {string} params.partyId - Party ID of the Party
   * @param {string} params.partyStatus=Active - Status of the Party (e.g. 'Active')
   * @param {string} params.partyClass=Party - Class of the Party
   * @param {string} params.partyType=Party - Type of the Party
   * @param {string} params.description - Description of the Party
   * @param {object} params.addresses - Object of Addresses associated with this Party
   * @param (object) params.emails - Object of Emails associated with this Party
   * @param {object} params.references - Object of References associated with this Party
   * @param {string} params.createdBy - ID of the user that created the Party (required if creating a new Party)
   * @param {string} params.updatedBy - ID of the user that updated the Party (use if amending existing Party)
   * @param {date} params.createdTime - Time that the Party was created (required if creating new Party)
   * @param {date} params.updatedTime - Time that the Party was updated (required if amending existing Party)
   * @param {number} params.version - Version number of the Party
   */
  constructor({ assetManagerId, partyId, partyStatus='Active', partyClass='Party', partyType='Party', description='', addresses={}, emails={}, references={}, createdBy, updatedBy, createdTime, updatedTime, version }) {
    super({
      createdBy,
      updatedBy,
      createdTime,
      updatedTime,
      version
    })
    Object.defineProperties(this, {
      _emails: { writable: true, enumerable: false },
      emails: {
        get: function() { return this._emails },
        set: function(newEmails) {
          if (Object.keys(newEmails).length > 0) {
            let primaryEmail = 0
            for (let type in newEmails) {
              if (newEmails.hasOwnProperty(type)) {
                this._checkTypes('email', newEmails[type], Email)
                this._checkEmail(newEmails[type].email)
                if (newEmails[type].emailPrimary) {
                  primaryEmail++
                }
              }
            }
            if (primaryEmail == 0) {
              throw new Error('At least 1 primary email must be supplied')
            }
            this._emails = newEmails
          } else {
            this._emails = {}
          }
        },
        enumerable: true
      },
      _addresses: { writable: true, enumerable: false },
      addresses: {
        get: function() { return this._addresses },
        set: function(newAddresses) {
          if (Object.keys(newAddresses).length > 0) {
            let primaryAdd = 0
            for (let type in newAddresses) {
              if (newAddresses.hasOwnProperty(type)) {
                this._checkTypes('address', newAddresses[type], Address)
                if (newAddresses[type].addressPrimary) {
                  primaryAdd++
                }
              }
            }
            if (primaryAdd == 0) {
              throw new Error('At least 1 primary address must be supplied')
            }
            this._addresses = newAddresses
          } else {
            this._addresses = {}
          }
        }
      }
    })
    this.assetManagerId = assetManagerId
    this.partyId = partyId
    this.partyStatus = partyStatus
    this.partyClass = partyClass
    this.partyType = partyType
    this.description = description<commit_msg>Add enumerable flag to addresses on Party<commit_after>import { AMaaSModel } from '../../core'
import { Address, Email } from '../Children'

import { retrieveData } from '../../utils/network'

/**
 * Class representing a Party
 * @extends AMaaSModel
 */
class Party extends AMaaSModel {
  /**
   * Construct a new Party object
   * @param {object} params - Party creation options
   * @param {number} params.assetManagerId - Asset Manager ID of the Party
   * @param {string} params.partyId - Party ID of the Party
   * @param {string} params.partyStatus=Active - Status of the Party (e.g. 'Active')
   * @param {string} params.partyClass=Party - Class of the Party
   * @param {string} params.partyType=Party - Type of the Party
   * @param {string} params.description - Description of the Party
   * @param {object} params.addresses - Object of Addresses associated with this Party
   * @param (object) params.emails - Object of Emails associated with this Party
   * @param {object} params.references - Object of References associated with this Party
   * @param {string} params.createdBy - ID of the user that created the Party (required if creating a new Party)
   * @param {string} params.updatedBy - ID of the user that updated the Party (use if amending existing Party)
   * @param {date} params.createdTime - Time that the Party was created (required if creating new Party)
   * @param {date} params.updatedTime - Time that the Party was updated (required if amending existing Party)
   * @param {number} params.version - Version number of the Party
   */
  constructor({ assetManagerId, partyId, partyStatus='Active', partyClass='Party', partyType='Party', description='', addresses={}, emails={}, references={}, createdBy, updatedBy, createdTime, updatedTime, version }) {
    super({
      createdBy,
      updatedBy,
      createdTime,
      updatedTime,
      version
    })
    Object.defineProperties(this, {
      _emails: { writable: true, enumerable: false },
      emails: {
        get: function() { return this._emails },
        set: function(newEmails) {
          if (Object.keys(newEmails).length > 0) {
            let primaryEmail = 0
            for (let type in newEmails) {
              if (newEmails.hasOwnProperty(type)) {
                this._checkTypes('email', newEmails[type], Email)
                this._checkEmail(newEmails[type].email)
                if (newEmails[type].emailPrimary) {
                  primaryEmail++
                }
              }
            }
            if (primaryEmail == 0) {
              throw new Error('At least 1 primary email must be supplied')
            }
            this._emails = newEmails
          } else {
            this._emails = {}
          }
        },
        enumerable: true
      },
      _addresses: { writable: true, enumerable: false },
      addresses: {
        get: function() { return this._addresses },
        set: function(newAddresses) {
          if (Object.keys(newAddresses).length > 0) {
            let primaryAdd = 0
            for (let type in newAddresses) {
              if (newAddresses.hasOwnProperty(type)) {
                this._checkTypes('address', newAddresses[type], Address)
                if (newAddresses[type].addressPrimary) {
                  primaryAdd++
                }
              }
            }
            if (primaryAdd == 0) {
              throw new Error('At least 1 primary address must be supplied')
            }
            this._addresses = newAddresses
          } else {
            this._addresses = {}
          }
        }, enumerable: true
      }
    })
    this.assetManagerId = assetManagerId
    this.partyId = partyId
    this.partyStatus = partyStatus
    this.partyClass = partyClass
    this.partyType = partyType
    this.description = description
{'fraction_non_alphanumeric': 0.10171277997364954, 'fraction_numerical': 0.002108036890645586, 'mean_word_length': 2.212441811256877, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1330994', 'n_tokens_mistral': 2020, 'n_tokens_neox': 1985, 'n_words': 633}