Source code for ace.centralize.models.claim
"""
Claim models for Centralize
Models for insurance claims (create, update, update status).
Based on the Claim GraphQL schema (ClaimCreateInput,
ClaimUpdateInput, ClaimStatusUpdateInput, etc.)
"""
from datetime import datetime
from typing import List, Optional
from ace.centralize.models.base import ModelBase
[docs]
class IncidentCreateInput(ModelBase):
"""Maps to IncidentCreateInput in GraphQL schema."""
[docs]
def __init__(
self,
incident_date_time: datetime,
incident_description: str,
incident_type_id: int,
is_first_incident: bool,
):
self.incidentDateTime = incident_date_time
self.incidentDescription = incident_description
self.incidentTypeId = incident_type_id
self.isFirstIncident = is_first_incident
[docs]
class IncidentUpdateInput(ModelBase):
"""Maps to IncidentUpdateInput in GraphQL schema."""
[docs]
def __init__(
self,
operation: str,
incident_id: Optional[int] = None,
incident_date_time: Optional[datetime] = None,
incident_description: Optional[str] = None,
incident_type_id: Optional[int] = None,
is_first_incident: Optional[bool] = None,
):
self.operation = operation
if incident_id is not None:
self.incidentId = incident_id
if incident_date_time is not None:
self.incidentDateTime = incident_date_time
if incident_description is not None:
self.incidentDescription = incident_description
if incident_type_id is not None:
self.incidentTypeId = incident_type_id
if is_first_incident is not None:
self.isFirstIncident = is_first_incident
[docs]
class ClaimTerminateReasonInput(ModelBase):
"""Maps to ClaimTerminateReasonInput in GraphQL schema."""
[docs]
def __init__(
self,
reason_id: int,
comment: Optional[str] = None,
):
self.reasonId = reason_id
if comment is not None:
self.comment = comment
[docs]
class ClaimCreateInput(ModelBase):
"""Maps to ClaimCreateInput in GraphQL schema."""
[docs]
def __init__(
self,
estimate_claim_value: float,
estimate_claim_value_currency_type_id: int,
language_id: int,
line_of_business_id: int,
notification_date_time: datetime,
claim_type_id: int,
claim_number: Optional[str] = None,
policy_id: Optional[int] = None,
status: Optional[int] = None,
submitted_policy_number: Optional[str] = None,
incidents: Optional[List[IncidentCreateInput]] = None,
):
self.estimateClaimValue = estimate_claim_value
self.estimateClaimValueCurrencyTypeId = estimate_claim_value_currency_type_id
self.languageId = language_id
self.lineOfBusinessId = line_of_business_id
self.notificationDateTime = notification_date_time
self.claimTypeId = claim_type_id
if claim_number is not None:
self.claimNumber = claim_number
if policy_id is not None:
self.policyId = policy_id
if status is not None:
self.status = status
if submitted_policy_number is not None:
self.submittedPolicyNumber = submitted_policy_number
if incidents is not None:
self.incidents = incidents
[docs]
class ClaimUpdateInput(ModelBase):
"""Maps to ClaimUpdateInput in GraphQL schema."""
[docs]
def __init__(
self,
claim_id: int,
language_id: int,
claim_type_id: Optional[int] = None,
estimate_claim_value: Optional[float] = None,
estimate_claim_value_currency_type_id: Optional[int] = None,
line_of_business_id: Optional[int] = None,
notification_date_time: Optional[datetime] = None,
submitted_policy_number: Optional[str] = None,
incidents: Optional[List[IncidentUpdateInput]] = None,
):
self.claimId = claim_id
self.languageId = language_id
if claim_type_id is not None:
self.claimTypeId = claim_type_id
if estimate_claim_value is not None:
self.estimateClaimValue = estimate_claim_value
if estimate_claim_value_currency_type_id is not None:
self.estimateClaimValueCurrencyTypeId = estimate_claim_value_currency_type_id
if line_of_business_id is not None:
self.lineOfBusinessId = line_of_business_id
if notification_date_time is not None:
self.notificationDateTime = notification_date_time
if submitted_policy_number is not None:
self.submittedPolicyNumber = submitted_policy_number
if incidents is not None:
self.incidents = incidents
[docs]
class ClaimStatusUpdateInput(ModelBase):
"""Maps to ClaimStatusUpdateInput in GraphQL schema."""
[docs]
def __init__(
self,
language_id: int,
claim_id: Optional[int] = None,
claim_status_id: Optional[int] = None,
claim_terminate_reason: Optional[ClaimTerminateReasonInput] = None,
):
self.languageId = language_id
if claim_id is not None:
self.claimId = claim_id
if claim_status_id is not None:
self.claimStatusId = claim_status_id
if claim_terminate_reason is not None:
self.claimTerminateReason = claim_terminate_reason