Source code for ace.centralize.models.party

"""
    Party models for Centralize

    Models for parties, contacts, addresses, emails, phones, individuals, and organizations.

    Based on the Party GraphQL schema (PartyParamsInput, PartyUpdateGqlParamsInput,
    PersonParamsInput, OrganizationParamsInput, etc.)
"""
from datetime import date
from typing import List, Optional

from ace.centralize.models.base import ModelBase


# ================================================ DISPLAY NAME ========================================================

[docs] class DisplayNameTranslationInput(ModelBase): """Maps to DisplayNameTranslationInput in GraphQL schema."""
[docs] def __init__(self, id: int, translation: str = ""): self.id = id self.translation = translation
# Backward-compatible alias TranslationObject = DisplayNameTranslationInput
[docs] class DisplayNameInput(ModelBase): """Maps to DisplayNameInput in GraphQL schema."""
[docs] def __init__( self, default: str = "", translations: Optional[List[DisplayNameTranslationInput]] = None, ): self.default = default if translations is not None: self.translations = translations
# Backward-compatible alias DisplayNameObject = DisplayNameInput
[docs] class DisplayNameUpdateTranslationInput(ModelBase): """Maps to DisplayNameUpdateTranslationInput in GraphQL schema."""
[docs] def __init__( self, id: int, operation: str, translation: Optional[str] = None, ): self.id = id self.operation = operation if translation is not None: self.translation = translation
[docs] class DisplayUpdateNameInput(ModelBase): """Maps to DisplayUpdateNameInput in GraphQL schema."""
[docs] def __init__( self, default: Optional[str] = None, translations: Optional[List[DisplayNameUpdateTranslationInput]] = None, ): if default is not None: self.default = default if translations is not None: self.translations = translations
# ============================================== CONTACT (Create) ======================================================
[docs] class AddressParamsInput(ModelBase): """Maps to AddressParamsInput in GraphQL schema (for create)."""
[docs] def __init__( self, address_type_id: int, additional_info: Optional[str] = None, city: Optional[str] = None, country_id: Optional[int] = None, main: Optional[bool] = None, postal_code: Optional[str] = None, state_id: Optional[int] = None, street: Optional[str] = None, ): self.addressTypeId = address_type_id if additional_info is not None: self.additionalInfo = additional_info if city is not None: self.city = city if country_id is not None: self.countryId = country_id if main is not None: self.main = main if postal_code is not None: self.postalCode = postal_code if state_id is not None: self.stateId = state_id if street is not None: self.street = street
# Backward-compatible alias AddressObject = AddressParamsInput
[docs] class EmailParamsInput(ModelBase): """Maps to EmailParamsInput in GraphQL schema (for create)."""
[docs] def __init__( self, email_address: str, email_type_id: int, main: Optional[bool] = None, ): self.emailAddress = email_address self.emailTypeId = email_type_id if main is not None: self.main = main
# Backward-compatible alias EmailObject = EmailParamsInput
[docs] class PhoneParamsInput(ModelBase): """Maps to PhoneParamsInput in GraphQL schema (for create)."""
[docs] def __init__( self, phone_type_id: int, extension: Optional[str] = None, main: Optional[bool] = None, phone_value: Optional[str] = None, ): self.phoneTypeId = phone_type_id if extension is not None: self.extension = extension if main is not None: self.main = main if phone_value is not None: self.phoneValue = phone_value
# Backward-compatible alias PhoneObject = PhoneParamsInput
[docs] class ContactParamsInput(ModelBase): """Maps to ContactParamsInput in GraphQL schema (for create)."""
[docs] def __init__( self, addresses: Optional[List[AddressParamsInput]] = None, emails: Optional[List[EmailParamsInput]] = None, phones: Optional[List[PhoneParamsInput]] = None, preferred_communication_method_id: Optional[int] = None, ): if addresses is not None: self.addresses = addresses if emails is not None: self.emails = emails if phones is not None: self.phones = phones if preferred_communication_method_id is not None: self.preferredCommunicationMethodId = preferred_communication_method_id
# Backward-compatible alias ContactObject = ContactParamsInput # ============================================== CONTACT (Update) ======================================================
[docs] class AddressUpdateParamsInput(ModelBase): """Maps to AddressUpdateParamsInput in GraphQL schema."""
[docs] def __init__( self, operation: str, id: Optional[int] = None, address_type_id: Optional[int] = None, additional_info: Optional[str] = None, city: Optional[str] = None, country_id: Optional[int] = None, main: Optional[bool] = None, postal_code: Optional[str] = None, state_id: Optional[int] = None, street: Optional[str] = None, ): self.operation = operation if id is not None: self.id = id if address_type_id is not None: self.addressTypeId = address_type_id if additional_info is not None: self.additionalInfo = additional_info if city is not None: self.city = city if country_id is not None: self.countryId = country_id if main is not None: self.main = main if postal_code is not None: self.postalCode = postal_code if state_id is not None: self.stateId = state_id if street is not None: self.street = street
[docs] class EmailUpdateParamsInput(ModelBase): """Maps to EmailUpdateParamsInput in GraphQL schema."""
[docs] def __init__( self, operation: str, id: Optional[int] = None, email_address: Optional[str] = None, email_type_id: Optional[int] = None, main: Optional[bool] = None, ): self.operation = operation if id is not None: self.id = id if email_address is not None: self.emailAddress = email_address if email_type_id is not None: self.emailTypeId = email_type_id if main is not None: self.main = main
[docs] class PhoneUpdateParamsInput(ModelBase): """Maps to PhoneUpdateParamsInput in GraphQL schema."""
[docs] def __init__( self, operation: str, id: Optional[int] = None, phone_value: Optional[str] = None, phone_type_id: Optional[int] = None, extension: Optional[str] = None, main: Optional[bool] = None, ): self.operation = operation if id is not None: self.id = id if phone_value is not None: self.phoneValue = phone_value if phone_type_id is not None: self.phoneTypeId = phone_type_id if extension is not None: self.extension = extension if main is not None: self.main = main
[docs] class ContactUpdateParamsInput(ModelBase): """Maps to ContactUpdateParamsInput in GraphQL schema."""
[docs] def __init__( self, addresses: Optional[List[AddressUpdateParamsInput]] = None, emails: Optional[List[EmailUpdateParamsInput]] = None, phones: Optional[List[PhoneUpdateParamsInput]] = None, preferred_communication_method_id: Optional[int] = None, ): if addresses is not None: self.addresses = addresses if emails is not None: self.emails = emails if phones is not None: self.phones = phones if preferred_communication_method_id is not None: self.preferredCommunicationMethodId = preferred_communication_method_id
# ============================================== EMPLOYMENT ============================================================
[docs] class EmploymentParamsInput(ModelBase): """Maps to EmploymentParamsInput in GraphQL schema."""
[docs] def __init__( self, employer_name: Optional[str] = None, employment_status_id: Optional[int] = None, industry_type_id: Optional[int] = None, occupation: Optional[str] = None, ): if employer_name is not None: self.employerName = employer_name if employment_status_id is not None: self.employmentStatusId = employment_status_id if industry_type_id is not None: self.industryTypeId = industry_type_id if occupation is not None: self.occupation = occupation
# =========================================== INDIVIDUAL / PERSON ======================================================
[docs] class PersonParamsInput(ModelBase): """Maps to PersonParamsInput in GraphQL schema (for create)."""
[docs] def __init__( self, display_name: DisplayNameInput, birth_date: Optional[date] = None, citizenship_id: Optional[int] = None, death_date: Optional[date] = None, employee_number: Optional[str] = None, employment: Optional[EmploymentParamsInput] = None, first_name: Optional[str] = None, gender_id: Optional[int] = None, last_name: Optional[str] = None, marital_status_id: Optional[int] = None, middle_name: Optional[str] = None, occupation: Optional[str] = None, occupation_title: Optional[str] = None, orig_name: Optional[str] = None, preferred_language_id: Optional[int] = None, residency_status_id: Optional[int] = None, suffix: Optional[str] = None, title: Optional[str] = None, ): self.displayName = display_name if birth_date is not None: self.birthDate = birth_date if citizenship_id is not None: self.citizenshipId = citizenship_id if death_date is not None: self.deathDate = death_date if employee_number is not None: self.employeeNumber = employee_number if employment is not None: self.employment = employment if first_name is not None: self.firstName = first_name if gender_id is not None: self.genderId = gender_id if last_name is not None: self.lastName = last_name if marital_status_id is not None: self.maritalStatusId = marital_status_id if middle_name is not None: self.middleName = middle_name if occupation is not None: self.occupation = occupation if occupation_title is not None: self.occupationTitle = occupation_title if orig_name is not None: self.origName = orig_name if preferred_language_id is not None: self.preferredLanguageId = preferred_language_id if residency_status_id is not None: self.residencyStatusId = residency_status_id if suffix is not None: self.suffix = suffix if title is not None: self.title = title
# Backward-compatible alias IndividualObject = PersonParamsInput
[docs] class PersonUpdateParamsInput(ModelBase): """Maps to PersonUpdateParamsInput in GraphQL schema."""
[docs] def __init__( self, display_name: Optional[DisplayUpdateNameInput] = None, birth_date: Optional[date] = None, citizenship_id: Optional[int] = None, death_date: Optional[date] = None, employee_number: Optional[str] = None, employment: Optional[EmploymentParamsInput] = None, first_name: Optional[str] = None, gender_id: Optional[int] = None, last_name: Optional[str] = None, marital_status_id: Optional[int] = None, middle_name: Optional[str] = None, occupation: Optional[str] = None, occupation_title: Optional[str] = None, orig_name: Optional[str] = None, preferred_language_id: Optional[int] = None, residency_status_id: Optional[int] = None, suffix: Optional[str] = None, title: Optional[str] = None, ): if display_name is not None: self.displayName = display_name if birth_date is not None: self.birthDate = birth_date if citizenship_id is not None: self.citizenshipId = citizenship_id if death_date is not None: self.deathDate = death_date if employee_number is not None: self.employeeNumber = employee_number if employment is not None: self.employment = employment if first_name is not None: self.firstName = first_name if gender_id is not None: self.genderId = gender_id if last_name is not None: self.lastName = last_name if marital_status_id is not None: self.maritalStatusId = marital_status_id if middle_name is not None: self.middleName = middle_name if occupation is not None: self.occupation = occupation if occupation_title is not None: self.occupationTitle = occupation_title if orig_name is not None: self.origName = orig_name if preferred_language_id is not None: self.preferredLanguageId = preferred_language_id if residency_status_id is not None: self.residencyStatusId = residency_status_id if suffix is not None: self.suffix = suffix if title is not None: self.title = title
# ============================================== ORGANIZATION ==========================================================
[docs] class OrganizationParamsInput(ModelBase): """Maps to OrganizationParamsInput in GraphQL schema (for create)."""
[docs] def __init__( self, display_name: DisplayNameInput, annual_revenue: Optional[int] = None, dissolved_date: Optional[date] = None, employee_count: Optional[int] = None, established_date: Optional[date] = None, financial_end_day: Optional[int] = None, financial_end_month: Optional[int] = None, industry_type_id: Optional[int] = None, name: Optional[DisplayNameInput] = None, organization_legal_form_id: Optional[int] = None, organization_number: Optional[str] = None, organization_type_id: Optional[int] = None, preferred_language_id: Optional[int] = None, website: Optional[str] = None, ): self.displayName = display_name if annual_revenue is not None: self.annualRevenue = annual_revenue if dissolved_date is not None: self.dissolvedDate = dissolved_date if employee_count is not None: self.employeeCount = employee_count if established_date is not None: self.establishedDate = established_date if financial_end_day is not None: self.financialEndDay = financial_end_day if financial_end_month is not None: self.financialEndMonth = financial_end_month if industry_type_id is not None: self.industryTypeId = industry_type_id if name is not None: self.name = name if organization_legal_form_id is not None: self.organizationLegalFormId = organization_legal_form_id if organization_number is not None: self.organizationNumber = organization_number if organization_type_id is not None: self.organizationTypeId = organization_type_id if preferred_language_id is not None: self.preferredLanguageId = preferred_language_id if website is not None: self.website = website
# Backward-compatible alias OrganizationObject = OrganizationParamsInput
[docs] class OrganizationUpdateParamsInput(ModelBase): """Maps to OrganizationUpdateParamsInput in GraphQL schema."""
[docs] def __init__( self, annual_revenue: Optional[int] = None, display_name: Optional[DisplayUpdateNameInput] = None, dissolved_date: Optional[date] = None, employee_count: Optional[int] = None, established_date: Optional[date] = None, financial_end_day: Optional[int] = None, financial_end_month: Optional[int] = None, industry_type_id: Optional[int] = None, name: Optional[DisplayUpdateNameInput] = None, organization_legal_form_id: Optional[int] = None, organization_number: Optional[str] = None, organization_type_id: Optional[int] = None, preferred_language_id: Optional[int] = None, website: Optional[str] = None, ): if annual_revenue is not None: self.annualRevenue = annual_revenue if display_name is not None: self.displayName = display_name if dissolved_date is not None: self.dissolvedDate = dissolved_date if employee_count is not None: self.employeeCount = employee_count if established_date is not None: self.establishedDate = established_date if financial_end_day is not None: self.financialEndDay = financial_end_day if financial_end_month is not None: self.financialEndMonth = financial_end_month if industry_type_id is not None: self.industryTypeId = industry_type_id if name is not None: self.name = name if organization_legal_form_id is not None: self.organizationLegalFormId = organization_legal_form_id if organization_number is not None: self.organizationNumber = organization_number if organization_type_id is not None: self.organizationTypeId = organization_type_id if preferred_language_id is not None: self.preferredLanguageId = preferred_language_id if website is not None: self.website = website
# ============================================== BANK ACCOUNT ==========================================================
[docs] class CreateBankAccountParamsInput(ModelBase): """Maps to CreateBankAccountParamsInput in GraphQL schema."""
[docs] def __init__( self, account_number: str, branch_code: str, financial_institution_number: str, bank_account_type: Optional[int] = None, country_id: Optional[int] = None, ): self.accountNumber = account_number self.branchCode = branch_code self.financialInstitutionNumber = financial_institution_number if bank_account_type is not None: self.bankAccountType = bank_account_type if country_id is not None: self.countryId = country_id
# Backward-compatible alias BankAccount = CreateBankAccountParamsInput
[docs] class UpdateBankAccountParamsInput(ModelBase): """Maps to UpdateBankAccountParamsInput in GraphQL schema."""
[docs] def __init__( self, id: int, account_number: str, branch_code: str, financial_institution_number: str, bank_account_type_id: Optional[int] = None, country_id: Optional[int] = None, ): self.id = id self.accountNumber = account_number self.branchCode = branch_code self.financialInstitutionNumber = financial_institution_number if bank_account_type_id is not None: self.bankAccountTypeId = bank_account_type_id if country_id is not None: self.countryId = country_id
# ============================================== CREDIT SCORE ==========================================================
[docs] class CreditScoreCreateParamsInput(ModelBase): """Maps to CreditScoreCreateParamsInput in GraphQL schema."""
[docs] def __init__( self, value: str, description: Optional[str] = None, effective_date: Optional[date] = None, rating_agency_id: Optional[int] = None, ): self.value = value if description is not None: self.description = description if effective_date is not None: self.effectiveDate = effective_date if rating_agency_id is not None: self.ratingAgencyId = rating_agency_id
# Backward-compatible alias CreditScore = CreditScoreCreateParamsInput # ===================================================== PARTY =========================================================
[docs] class PartyParamsInput(ModelBase): """Maps to PartyParamsInput in GraphQL schema."""
[docs] def __init__( self, party_type_id: int, bank_accounts: Optional[List[CreateBankAccountParamsInput]] = None, contact: Optional[ContactParamsInput] = None, credit_scores: Optional[List[CreditScoreCreateParamsInput]] = None, external_identifier: Optional[str] = None, individual: Optional[PersonParamsInput] = None, organization: Optional[OrganizationParamsInput] = None, reference_number: Optional[str] = None, ): self.partyTypeId = party_type_id if bank_accounts is not None: self.bankAccounts = bank_accounts if contact is not None: self.contact = contact if credit_scores is not None: self.creditScores = credit_scores if external_identifier is not None: self.externalIdentifier = external_identifier if individual is not None: self.individual = individual if organization is not None: self.organization = organization if reference_number is not None: self.referenceNumber = reference_number
# Backward-compatible alias PartyObject = PartyParamsInput
[docs] class PartyUpdateGqlParamsInput(ModelBase): """Maps to PartyUpdateGqlParamsInput in GraphQL schema."""
[docs] def __init__( self, id: int, bank_accounts: Optional[List[UpdateBankAccountParamsInput]] = None, contact: Optional[ContactUpdateParamsInput] = None, external_identifier: Optional[str] = None, individual: Optional[PersonUpdateParamsInput] = None, organization: Optional[OrganizationUpdateParamsInput] = None, party_type_id: Optional[int] = None, reference_number: Optional[str] = None, ): self.id = id if bank_accounts is not None: self.bankAccounts = bank_accounts if contact is not None: self.contact = contact if external_identifier is not None: self.externalIdentifier = external_identifier if individual is not None: self.individual = individual if organization is not None: self.organization = organization if party_type_id is not None: self.partyTypeId = party_type_id if reference_number is not None: self.referenceNumber = reference_number
# Backward-compatible alias PartyUpdateObject = PartyUpdateGqlParamsInput