"""
Predefined SelectionSets for Party and related entities.
Based on the Party GraphQL schema output types:
GqlPartyDetail, GqlPerson, GqlOrganization, GqlContactDetail,
GqlAddress, GqlEmail, GqlPhone, GqlBankAccount, GqlCreditScore,
GqlDisplayNameDetail, GqlTranslationDetail, GqlEmployment,
GqlParticipantDetail, GqlPartyRole, GqlBeneficiaryRole, GqlTrusteeRole
"""
from ace.core.graphql import SelectionSet
[docs]
class DisplayNameSelections:
"""Reusable selection sets for DisplayName fields."""
MINIMAL = SelectionSet("default")
WITH_TRANSLATIONS = SelectionSet(
"default",
nested={
"translations": SelectionSet("id", "translation"),
}
)
[docs]
class EmploymentSelections:
"""Reusable selection sets for Employment fields."""
STANDARD = SelectionSet(
"id",
"employerName",
"employmentStatusId",
"industryTypeId",
"occupation",
)
[docs]
class IndividualSelections:
"""Reusable selection sets for Individual/Person fields."""
MINIMAL = SelectionSet(
"birthDate",
"firstName",
"lastName",
nested={
"displayName": DisplayNameSelections.MINIMAL,
}
)
STANDARD = SelectionSet(
"id",
"birthDate",
"deathDate",
"firstName",
"lastName",
"middleName",
"genderId",
"citizenshipId",
"maritalStatusId",
"occupation",
"occupationTitle",
"preferredLanguageId",
nested={
"displayName": DisplayNameSelections.MINIMAL,
}
)
FULL = SelectionSet(
"id",
"birthDate",
"deathDate",
"firstName",
"lastName",
"middleName",
"genderId",
"citizenshipId",
"maritalStatusId",
"occupation",
"occupationTitle",
"origName",
"preferredLanguageId",
"residencyStatusId",
"employeeNumber",
"suffix",
"title",
nested={
"displayName": DisplayNameSelections.WITH_TRANSLATIONS,
"employment": EmploymentSelections.STANDARD,
}
)
[docs]
class OrganizationSelections:
"""Reusable selection sets for Organization fields."""
MINIMAL = SelectionSet(
"id",
nested={
"displayName": DisplayNameSelections.MINIMAL,
}
)
STANDARD = SelectionSet(
"id",
"preferredLanguageId",
"website",
"establishedDate",
"dissolvedDate",
nested={
"displayName": DisplayNameSelections.MINIMAL,
"name": DisplayNameSelections.MINIMAL,
}
)
FULL = SelectionSet(
"id",
"annualRevenue",
"dissolvedDate",
"employeeCount",
"establishedDate",
"financialEndDay",
"financialEndMonth",
"industryTypeId",
"organizationLegalFormId",
"organizationNumber",
"organizationTypeId",
"preferredLanguageId",
"website",
nested={
"displayName": DisplayNameSelections.WITH_TRANSLATIONS,
"name": DisplayNameSelections.WITH_TRANSLATIONS,
}
)
[docs]
class BankAccountSelections:
"""Reusable selection sets for BankAccount fields."""
STANDARD = SelectionSet(
"id",
"accountNumber",
"bankAccountTypeId",
"branchCode",
"countryId",
"financialInstitutionNumber",
"partyId",
)
[docs]
class CreditScoreSelections:
"""Reusable selection sets for CreditScore fields."""
STANDARD = SelectionSet(
"id",
"value",
"ratingAgencyId",
"description",
"effectiveDate",
)
[docs]
class BeneficiaryRoleSelections:
"""Reusable selection sets for BeneficiaryRole fields."""
STANDARD = SelectionSet(
"id",
"beneficiaryTypeId",
"relationshipToInsuredId",
)
[docs]
class TrusteeRoleSelections:
"""Reusable selection sets for TrusteeRole fields."""
STANDARD = SelectionSet(
"id",
"trustTypeId",
)
[docs]
class PartyRoleSelections:
"""Reusable selection sets for PartyRole fields."""
MINIMAL = SelectionSet(
"id",
"partyRoleId",
)
STANDARD = SelectionSet(
"id",
"partyRoleId",
"sharedPercent",
"effectiveDate",
"terminationDate",
"terminationReasonId",
"statusId",
"agentContractId",
"entityId",
"entityTypeId",
"isIrrevocable",
"participantId",
)
FULL = SelectionSet(
"id",
"partyRoleId",
"sharedPercent",
"effectiveDate",
"terminationDate",
"terminationReasonId",
"statusId",
"agentContractId",
"entityId",
"entityTypeId",
"isIrrevocable",
"participantId",
"creationDateTimeUTC",
"creationUserId",
"lastUpdateDateTimeUTC",
"lastUpdateUserId",
"deletionDateTimeUTC",
"deletionUserId",
nested={
"beneficiary": BeneficiaryRoleSelections.STANDARD,
"trustee": TrusteeRoleSelections.STANDARD,
}
)
[docs]
class ParticipantSelections:
"""Reusable selection sets for Participant fields."""
MINIMAL = SelectionSet(
"id",
nested={
"party": SelectionSet("id"),
"roles": SelectionSet("id"),
}
)
STANDARD = SelectionSet(
"id",
"entityId",
"entityTypeId",
nested={
"party": SelectionSet(
"id",
"partyEntityTypeId",
"partyTypeId",
),
"roles": PartyRoleSelections.STANDARD,
}
)
FULL = SelectionSet(
"id",
"entityId",
"entityTypeId",
"creationDateTimeUTC",
"creationUserId",
"deletionDateTimeUTC",
"deletionUserId",
nested={
"party": SelectionSet(
"id",
"partyEntityTypeId",
"partyTypeId",
"externalIdentifier",
"referenceNumber",
nested={
"contact": ContactSelections.FULL,
"individual": IndividualSelections.FULL,
"organization": OrganizationSelections.STANDARD,
"bankAccounts": BankAccountSelections.STANDARD,
"creditScores": CreditScoreSelections.STANDARD,
}
),
"roles": PartyRoleSelections.FULL,
}
)
[docs]
class PartySelections:
"""Reusable selection sets for Party fields."""
MINIMAL = SelectionSet(
"id",
"partyTypeId",
"partyEntityTypeId",
)
STANDARD = SelectionSet(
"id",
"partyTypeId",
"partyEntityTypeId",
"externalIdentifier",
"referenceNumber",
nested={
"contact": ContactSelections.STANDARD,
"individual": IndividualSelections.STANDARD,
"organization": OrganizationSelections.STANDARD,
"bankAccounts": BankAccountSelections.STANDARD,
"creditScores": CreditScoreSelections.STANDARD,
}
)
FULL = SelectionSet(
"id",
"partyTypeId",
"partyEntityTypeId",
"externalIdentifier",
"referenceNumber",
nested={
"contact": ContactSelections.FULL,
"individual": IndividualSelections.FULL,
"organization": OrganizationSelections.FULL,
"bankAccounts": BankAccountSelections.STANDARD,
"creditScores": CreditScoreSelections.STANDARD,
}
)
# Mutation output selections
CREATE = SelectionSet(
"partyId",
"partyEntityTypeId",
nested={
"info": SelectionSet(
"id",
"partyEntityTypeId",
nested={
"individual": IndividualSelections.MINIMAL,
"organization": OrganizationSelections.MINIMAL,
"bankAccounts": BankAccountSelections.STANDARD,
"creditScores": CreditScoreSelections.STANDARD,
}
)
}
)
UPDATE = SelectionSet(
"partyId",
"partyEntityTypeId",
nested={
"info": SelectionSet(
"id",
nested={
"contact": ContactSelections.STANDARD,
"individual": IndividualSelections.STANDARD,
"organization": OrganizationSelections.STANDARD,
"bankAccounts": BankAccountSelections.STANDARD,
"creditScores": CreditScoreSelections.STANDARD,
}
)
}
)
BATCH = UPDATE