Source code for ace.centralize.models.participant
"""
Participant models for Centralize
Models for participants, roles, beneficiaries, and trustees.
Based on the Party GraphQL schema (ParticipantEntityLinkCreateParamsInput,
ParticipantRoleCreateParamsInput, ParticipantsEntityLinkUpdateParamsInput, etc.)
"""
from datetime import date
from typing import List, Optional
from ace.centralize.models.base import ModelBase
from ace.centralize.models.party import PartyParamsInput
# ===================================================== ROLES ==========================================================
[docs]
class BeneficiaryRoleParamsInput(ModelBase):
"""Maps to BeneficiaryRoleParamsInput in GraphQL schema."""
[docs]
def __init__(
self,
beneficiary_type_id: Optional[int] = None,
relationship_to_insured_id: Optional[int] = None,
):
if beneficiary_type_id is not None:
self.beneficiaryTypeId = beneficiary_type_id
if relationship_to_insured_id is not None:
self.relationshipToInsuredId = relationship_to_insured_id
# Backward-compatible alias
BeneficiaryRoleObject = BeneficiaryRoleParamsInput
[docs]
class TrusteeRoleParamsInput(ModelBase):
"""Maps to TrusteeRoleParamsInput in GraphQL schema."""
[docs]
def __init__(
self,
trust_type_id: Optional[int] = None,
):
if trust_type_id is not None:
self.trustTypeId = trust_type_id
# Backward-compatible alias
TrusteeRoleObject = TrusteeRoleParamsInput
[docs]
class ParticipantRoleCreateParamsInput(ModelBase):
"""Maps to ParticipantRoleCreateParamsInput in GraphQL schema."""
[docs]
def __init__(
self,
party_role_id: int,
agent_contract_id: Optional[int] = None,
beneficiary: Optional[BeneficiaryRoleParamsInput] = None,
effective_date: Optional[date] = None,
entity_id: Optional[int] = None,
entity_type_id: Optional[str] = None,
is_irrevocable: Optional[bool] = None,
link_uuid: Optional[str] = None,
shared_percent: Optional[float] = None,
termination_date: Optional[date] = None,
termination_reason_id: Optional[int] = None,
trustee: Optional[TrusteeRoleParamsInput] = None,
):
self.partyRoleId = party_role_id
if agent_contract_id is not None:
self.agentContractId = agent_contract_id
if beneficiary is not None:
self.beneficiary = beneficiary
if effective_date is not None:
self.effectiveDate = effective_date
if entity_id is not None:
self.entityId = entity_id
if entity_type_id is not None:
self.entityTypeId = entity_type_id
if is_irrevocable is not None:
self.isIrrevocable = is_irrevocable
if link_uuid is not None:
self.linkUUID = link_uuid
if shared_percent is not None:
self.sharedPercent = shared_percent
if termination_date is not None:
self.terminationDate = termination_date
if termination_reason_id is not None:
self.terminationReasonId = termination_reason_id
if trustee is not None:
self.trustee = trustee
# Backward-compatible alias
RoleObject = ParticipantRoleCreateParamsInput
[docs]
class ParticipantRoleEntityUpdateParamsInput(ModelBase):
"""Maps to ParticipantRoleEntityUpdateParamsInput in GraphQL schema."""
[docs]
def __init__(
self,
id: int,
agent_contract_id: Optional[int] = None,
beneficiary: Optional[BeneficiaryRoleParamsInput] = None,
effective_date: Optional[date] = None,
entity_id: Optional[int] = None,
entity_type_id: Optional[str] = None,
is_irrevocable: Optional[bool] = None,
link_uuid: Optional[str] = None,
party_role_id: Optional[int] = None,
shared_percent: Optional[float] = None,
termination_date: Optional[date] = None,
termination_reason_id: Optional[int] = None,
trustee: Optional[TrusteeRoleParamsInput] = None,
):
self.id = id
if agent_contract_id is not None:
self.agentContractId = agent_contract_id
if beneficiary is not None:
self.beneficiary = beneficiary
if effective_date is not None:
self.effectiveDate = effective_date
if entity_id is not None:
self.entityId = entity_id
if entity_type_id is not None:
self.entityTypeId = entity_type_id
if is_irrevocable is not None:
self.isIrrevocable = is_irrevocable
if link_uuid is not None:
self.linkUUID = link_uuid
if party_role_id is not None:
self.partyRoleId = party_role_id
if shared_percent is not None:
self.sharedPercent = shared_percent
if termination_date is not None:
self.terminationDate = termination_date
if termination_reason_id is not None:
self.terminationReasonId = termination_reason_id
if trustee is not None:
self.trustee = trustee
[docs]
class ParticipantRoleUpdateParamsInput(ModelBase):
"""Maps to ParticipantRoleUpdateParamsInput in GraphQL schema (for standalone updateParticipant)."""
[docs]
def __init__(
self,
operation: str,
agent_contract_id: Optional[int] = None,
beneficiary: Optional[BeneficiaryRoleParamsInput] = None,
effective_date: Optional[date] = None,
id: Optional[int] = None,
is_irrevocable: Optional[bool] = None,
party_role_id: Optional[int] = None,
shared_percent: Optional[float] = None,
termination_date: Optional[date] = None,
termination_reason_id: Optional[int] = None,
trustee: Optional[TrusteeRoleParamsInput] = None,
):
self.operation = operation
if agent_contract_id is not None:
self.agentContractId = agent_contract_id
if beneficiary is not None:
self.beneficiary = beneficiary
if effective_date is not None:
self.effectiveDate = effective_date
if id is not None:
self.id = id
if is_irrevocable is not None:
self.isIrrevocable = is_irrevocable
if party_role_id is not None:
self.partyRoleId = party_role_id
if shared_percent is not None:
self.sharedPercent = shared_percent
if termination_date is not None:
self.terminationDate = termination_date
if termination_reason_id is not None:
self.terminationReasonId = termination_reason_id
if trustee is not None:
self.trustee = trustee
# ================================================= PARTICIPANT =======================================================
[docs]
class ParticipantEntityLinkCreateParamsInput(ModelBase):
"""Maps to ParticipantEntityLinkCreateParamsInput in GraphQL schema."""
[docs]
def __init__(
self,
party_id: Optional[int] = None,
create_party: Optional[bool] = None,
party: Optional[PartyParamsInput] = None,
roles: Optional[List[ParticipantRoleCreateParamsInput]] = None,
):
if party_id is not None:
self.partyId = party_id
if create_party is not None:
self.createParty = create_party
if party is not None:
self.party = party
if roles is not None:
self.roles = roles
# Backward-compatible alias
CreateParticipantObject = ParticipantEntityLinkCreateParamsInput
[docs]
class ParticipantEntityLinkUpdateParamsInput(ModelBase):
"""Maps to ParticipantEntityLinkUpdateParamsInput in GraphQL schema."""
[docs]
def __init__(
self,
participant_id: int,
roles_to_add: Optional[List[ParticipantRoleCreateParamsInput]] = None,
roles_to_delete: Optional[List[int]] = None,
roles_to_update: Optional[List[ParticipantRoleEntityUpdateParamsInput]] = None,
):
self.id = participant_id
if roles_to_add is not None:
self.rolesToAdd = roles_to_add
if roles_to_delete is not None:
self.rolesToDelete = roles_to_delete
if roles_to_update is not None:
self.rolesToUpdate = roles_to_update
# Backward-compatible alias
UpdateParticipantObject = ParticipantEntityLinkUpdateParamsInput
[docs]
class ParticipantsEntityLinkUpdateParamsInput(ModelBase):
"""Maps to ParticipantsEntityLinkUpdateParamsInput in GraphQL schema."""
[docs]
def __init__(
self,
participants_to_link: Optional[List[ParticipantEntityLinkCreateParamsInput]] = None,
participants_to_unlink: Optional[List[int]] = None,
participants_to_update: Optional[List[ParticipantEntityLinkUpdateParamsInput]] = None,
):
if participants_to_link is not None:
self.participantsToLink = participants_to_link
if participants_to_unlink is not None:
self.participantsToUnLink = participants_to_unlink
if participants_to_update is not None:
self.participantsToUpdate = participants_to_update
# Backward-compatible alias
ParticipantsEntityLinkUpdateParamsInputObject = ParticipantsEntityLinkUpdateParamsInput
# ========================================= STANDALONE MUTATIONS =======================================================
[docs]
class ParticipantLinkCreateParamsInput(ModelBase):
"""Maps to ParticipantLinkCreateParamsInput in GraphQL schema (for standalone linkParticipant)."""
[docs]
def __init__(
self,
entity_id: int,
entity_type_id: str,
party_id: int,
roles: Optional[List[ParticipantRoleCreateParamsInput]] = None,
):
self.entityId = entity_id
self.entityTypeId = entity_type_id
self.partyId = party_id
if roles is not None:
self.roles = roles