# coding: utf-8

"""
    Acre Platform User API

    # CORS CORS is implemented by all Acre API endpoints and only certain hostnames are allowed for each deployment of the API. If your use case requires calling the Acre User API from a browser, please contact Acre to arrange the appropriate configuration. # API Authentication The primary method of authentication for users of the Acre API is with the use of JSON Web Tokens (JWTs), which are suplemented by an application specific API Key. The API key must be provided through the `X-API-KEY` HTTP header and will be provided by your Acre Customer Success Manager. The JWT must be provided through a cookie with key of `authorization`. The JWT must be generated and signed as per the following section. # Generating JWTs JWT must either be generated by a third-party such as Azure ADB2C that has been configured for the appropriate service and/or user account, or alternatively can be generated locally and signed by an private key for which the public key has been made available to Acre via a JWKS URL. In addition to being signed by your private key, the JWT will also need to contain at a minimum:  * An issuer `iss`, which must be a valid URI previously agreed with Acre.  * A subject `sub`, which must be a unique identifier for the user and/or service account previously agreed with Acre.  * An expiry time `exp` which must not be more than four hours in the future.  * A not before time `nbf` which must be in the past, but not greater than six hours in the past.  The JWT should be signed using RS256.

    The version of the OpenAPI document: 1.0
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from acre_api.models.case_protection_length_of_time import CaseProtectionLengthOfTime
from acre_api.models.cdm_protection_requirements import CdmProtectionRequirements
from typing import Optional, Set
from typing_extensions import Self

class CdmCaseProtection(BaseModel):
    """
    CaseProtection contains protection related information.
    """ # noqa: E501
    has_client_accepted_protection_advice: Optional[StrictBool] = Field(default=None, description="Soft compliance gate, required for broker to begin advice process.")
    client_advice_limit: Optional[StrictBool] = Field(default=None, description="If the client chooses to limit the scope of protection advice. DEPRECATED: use protection.requirements.objectives.advice_limit instead.")
    client_advice_limit_details: Optional[StrictStr] = Field(default=None, description="If the client wants, they can limit the scope of advice (represented in client_advice_limit). If that's the case, details are to be recorded here. DEPRECATED: use protection.requirements.objectives.advice_limit_details instead.")
    death_needs_income_amount: Optional[StrictStr] = Field(default=None, description="The amount of regular income the client would need to cover dependencies and commitments should they die. DEPRECATED: use protection.requirements.family_income_benefits[].cover_amount instead.")
    death_needs_income_term: Optional[StrictInt] = Field(default=None, description="The term for which regular income the client would be needed, in months. DEPRECATED: use protection.requirements.family_income_benefits[].term_years instead.")
    death_needs_lump_sum_amount: Optional[StrictStr] = Field(default=None, description="The lump sum the client would need to cover dependencies and commitments should they die. DEPRECATED: use protection.requirements.life_and_critical_illness[].cover_amount instead.")
    death_needs_lump_sum_term: Optional[StrictInt] = Field(default=None, description="The term for which the lump sum the client would be necessary. DEPRECATED: use protection.requirements.life_and_critical_illness[].term_years instead.")
    illness_needs_income_amount: Optional[StrictStr] = Field(default=None, description="The amount of regular income the client would need to cover dependencies and commitments should they become seriously ill. DEPRECATED: use protection.requirements.income_protection[].cover_amount instead.")
    illness_needs_income_term: Optional[StrictInt] = Field(default=None, description="The term for which regular income would be necessary in the case of illness. DEPRECATED: use protection.requirements.income_protection[].term_years instead.")
    death_needs_lump_sum_term_justification: Optional[StrictStr] = Field(default=None, description="An explanation as to the reasoning for the death need term length(s). DEPRECATED: use protection.requirements.life_and_critical_illness[].cover_reason instead.")
    death_needs_income_term_justification: Optional[StrictStr] = Field(default=None, description="An explanation as to the reasoning for the death need term length(s). DEPRECATED: use protection.requirements.life_and_critical_illness[].term_reason instead.")
    illness_needs_deferrment_period_weeks: Optional[StrictInt] = Field(default=None, description="The amount of time between making a claim and receiving payments should they become seriously ill. DEPRECATED: use protection.requirements.income_protection[].deferral_weeks instead.")
    illness_needs_met_by_preexisting: Optional[StrictBool] = Field(default=None, description="State if illness shortfall needs are met by preexisting policies. DEPRECATED: use protection.requirements.income_protection[].existing_policy instead.")
    any_remaning_shortfalls: Optional[StrictBool] = Field(default=None, description="State if any shortfalls remain after the recommendation.")
    justify_remaining_shortfalls: Optional[StrictStr] = Field(default=None, description="If any shortfalls remain, explain and justify them.")
    additional_notes: Optional[StrictStr] = Field(default=None, description="Any additional notes for suitability report.")
    include_employee_benefits_in_shortfall: Optional[StrictBool] = Field(default=None, description="The client must specify whether or not they want their employee benefits to count towards their shortfall, this is usually dissuaded by brokers.")
    employee_benefits_shortfall_reasoning: Optional[StrictStr] = Field(default=None, description="The client must justify the decision they make regarding employer benefits, whether they include or exclude.")
    client_protection_objectives_circumstances: Optional[StrictStr] = Field(default=None, description="Objectives and circumstances, a short, high-level summary of what the client is looking for. DEPRECATED: use protection.requirements.objectives.client_protection_objectives_circumstances instead.")
    justify_recommendation: Optional[StrictStr] = None
    recommend_placing_in_trust: Optional[StrictBool] = None
    inheritance_advice_indicator: Optional[StrictBool] = None
    insistent_client_indicator: Optional[StrictBool] = None
    specific_trust_recommendation: Optional[StrictBool] = None
    death_needs_lump_sum_client_ids: Optional[List[StrictStr]] = Field(default=None, description="Clients which need a lump sum amount in case of death event DEPRECATED: use protection.requirements.life_and_critical_illness[].client_ids instead.")
    lump_sum_has_critical_illness_requirement: Optional[StrictBool] = Field(default=None, description="Should receive a lump sum in case of critical illness DEPRECATED: use protection.requirements.life_and_critical_illness[].scenario instead.")
    lump_sum_has_death_requirement: Optional[StrictBool] = Field(default=None, description="Should receive a lump sum in case of death DEPRECATED: use protection.requirements.life_and_critical_illness[].scenario instead.")
    death_lump_sum_needs_met_by_preexisting: Optional[StrictBool] = Field(default=None, description="State if death lump sum shortfall needs are met by preexisting policies DEPRECATED: use protection.requirements.life_and_critical_illness[].existing_policy instead.")
    death_needs_income_client_ids: Optional[List[StrictStr]] = Field(default=None, description="Clients which need an income in case of death event DEPRECATED: use protection.requirements.family_income_benefits[].client_ids instead.")
    income_has_critical_illness_requirement: Optional[StrictBool] = Field(default=None, description="Should receive an income in case of critical illness DEPRECATED: use protection.requirements.family_income_benefits[].scenario instead.")
    income_has_death_requirement: Optional[StrictBool] = Field(default=None, description="Should receive an income in case of death DEPRECATED: use protection.requirements.family_income_benefits[].scenario instead.")
    death_income_needs_met_by_preexisting: Optional[StrictBool] = Field(default=None, description="State if death income shortfall needs are met by preexisting policies DEPRECATED: use protection.requirements.family_income_benefits[].existing_policy instead.")
    illness_needs_client_ids: Optional[List[StrictStr]] = Field(default=None, description="Clients which need an income in case of illness event DEPRECATED: use protection.requirements.income_protection[].client_ids instead.")
    funeral_needs_client_ids: Optional[List[StrictStr]] = Field(default=None, description="Clients which need to cover funeral costs in case of death DEPRECATED: use protection.requirements.whole_of_life[].client_ids instead.")
    funeral_needs_lump_sum_amount: Optional[StrictStr] = Field(default=None, description="The lump sum the client would need to cover funeral costs should they die DEPRECATED: use protection.requirements.whole_of_life[].cover_amount instead.")
    funeral_needs_met_by_preexisting: Optional[StrictBool] = Field(default=None, description="State if funeral shortfall needs are met by preexisting policies DEPRECATED: use protection.requirements.whole_of_life[].existing_policy instead.")
    funeral_needs_justification: Optional[StrictStr] = Field(default=None, description="An explanation as to the reasoning for the funeral needs DEPRECATED: use protection.requirements.whole_of_life[].cover_reason instead.")
    rebroke_decision_advantages_and_disadvantages: Optional[StrictStr] = None
    trust_details: Optional[StrictStr] = None
    client_confirms_terms_exceeding_retirement_affordable: Optional[StrictBool] = None
    illness_needs_term_justification: Optional[StrictStr] = Field(default=None, description="An explanation as to the reasoning for the illness need term length(s) DEPRECATED: use protection.requirements.income_protection[].term_reason instead.")
    length_of_time_payment_without_work: Optional[CaseProtectionLengthOfTime] = CaseProtectionLengthOfTime.INVALID_LENGTH
    has_existing_policies: Optional[StrictBool] = Field(default=None, description="Confirms if client has any existing protection policies.")
    has_employee_benefits: Optional[StrictBool] = Field(default=None, description="Confirms if client has any employee benefits.")
    suitability_report_recommendation_introduction_protection: Optional[StrictStr] = Field(default=None, description="Allows broker to introduce the protection suitability report to provide context for the client.")
    additional_budget_details: Optional[StrictStr] = Field(default=None, description="Allows broker to add additional details to the protection budget section to provide context for the client.")
    additional_considerations_detail: Optional[StrictStr] = Field(default=None, description="Allows broker to add additional details to the Remaining Considerations section to provide context for the client.")
    death_needs_lump_sum_amount_justification: Optional[StrictStr] = Field(default=None, description="An explanation as to the reasoning for the death need lump sum amount. DEPRECATED: use protection.requirements.life_and_critical_illness[].cover_reason instead.")
    death_needs_income_amount_justification: Optional[StrictStr] = Field(default=None, description="An explanation as to the reasoning for the death need income amount. DEPRECATED: use protection.requirements.family_income_benefits[].cover_reason instead.")
    illness_needs_income_amount_justification: Optional[StrictStr] = Field(default=None, description="An explanation as to the reasoning for the illness need income amount. DEPRECATED: use protection.requirements.income_protection[].cover_reason instead.")
    requirements: Optional[CdmProtectionRequirements] = None
    __properties: ClassVar[List[str]] = ["has_client_accepted_protection_advice", "client_advice_limit", "client_advice_limit_details", "death_needs_income_amount", "death_needs_income_term", "death_needs_lump_sum_amount", "death_needs_lump_sum_term", "illness_needs_income_amount", "illness_needs_income_term", "death_needs_lump_sum_term_justification", "death_needs_income_term_justification", "illness_needs_deferrment_period_weeks", "illness_needs_met_by_preexisting", "any_remaning_shortfalls", "justify_remaining_shortfalls", "additional_notes", "include_employee_benefits_in_shortfall", "employee_benefits_shortfall_reasoning", "client_protection_objectives_circumstances", "justify_recommendation", "recommend_placing_in_trust", "inheritance_advice_indicator", "insistent_client_indicator", "specific_trust_recommendation", "death_needs_lump_sum_client_ids", "lump_sum_has_critical_illness_requirement", "lump_sum_has_death_requirement", "death_lump_sum_needs_met_by_preexisting", "death_needs_income_client_ids", "income_has_critical_illness_requirement", "income_has_death_requirement", "death_income_needs_met_by_preexisting", "illness_needs_client_ids", "funeral_needs_client_ids", "funeral_needs_lump_sum_amount", "funeral_needs_met_by_preexisting", "funeral_needs_justification", "rebroke_decision_advantages_and_disadvantages", "trust_details", "client_confirms_terms_exceeding_retirement_affordable", "illness_needs_term_justification", "length_of_time_payment_without_work", "has_existing_policies", "has_employee_benefits", "suitability_report_recommendation_introduction_protection", "additional_budget_details", "additional_considerations_detail", "death_needs_lump_sum_amount_justification", "death_needs_income_amount_justification", "illness_needs_income_amount_justification", "requirements"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )


    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of CdmCaseProtection from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # override the default output from pydantic by calling `to_dict()` of requirements
        if self.requirements:
            _dict['requirements'] = self.requirements.to_dict()
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of CdmCaseProtection from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "has_client_accepted_protection_advice": obj.get("has_client_accepted_protection_advice"),
            "client_advice_limit": obj.get("client_advice_limit"),
            "client_advice_limit_details": obj.get("client_advice_limit_details"),
            "death_needs_income_amount": obj.get("death_needs_income_amount"),
            "death_needs_income_term": obj.get("death_needs_income_term"),
            "death_needs_lump_sum_amount": obj.get("death_needs_lump_sum_amount"),
            "death_needs_lump_sum_term": obj.get("death_needs_lump_sum_term"),
            "illness_needs_income_amount": obj.get("illness_needs_income_amount"),
            "illness_needs_income_term": obj.get("illness_needs_income_term"),
            "death_needs_lump_sum_term_justification": obj.get("death_needs_lump_sum_term_justification"),
            "death_needs_income_term_justification": obj.get("death_needs_income_term_justification"),
            "illness_needs_deferrment_period_weeks": obj.get("illness_needs_deferrment_period_weeks"),
            "illness_needs_met_by_preexisting": obj.get("illness_needs_met_by_preexisting"),
            "any_remaning_shortfalls": obj.get("any_remaning_shortfalls"),
            "justify_remaining_shortfalls": obj.get("justify_remaining_shortfalls"),
            "additional_notes": obj.get("additional_notes"),
            "include_employee_benefits_in_shortfall": obj.get("include_employee_benefits_in_shortfall"),
            "employee_benefits_shortfall_reasoning": obj.get("employee_benefits_shortfall_reasoning"),
            "client_protection_objectives_circumstances": obj.get("client_protection_objectives_circumstances"),
            "justify_recommendation": obj.get("justify_recommendation"),
            "recommend_placing_in_trust": obj.get("recommend_placing_in_trust"),
            "inheritance_advice_indicator": obj.get("inheritance_advice_indicator"),
            "insistent_client_indicator": obj.get("insistent_client_indicator"),
            "specific_trust_recommendation": obj.get("specific_trust_recommendation"),
            "death_needs_lump_sum_client_ids": obj.get("death_needs_lump_sum_client_ids"),
            "lump_sum_has_critical_illness_requirement": obj.get("lump_sum_has_critical_illness_requirement"),
            "lump_sum_has_death_requirement": obj.get("lump_sum_has_death_requirement"),
            "death_lump_sum_needs_met_by_preexisting": obj.get("death_lump_sum_needs_met_by_preexisting"),
            "death_needs_income_client_ids": obj.get("death_needs_income_client_ids"),
            "income_has_critical_illness_requirement": obj.get("income_has_critical_illness_requirement"),
            "income_has_death_requirement": obj.get("income_has_death_requirement"),
            "death_income_needs_met_by_preexisting": obj.get("death_income_needs_met_by_preexisting"),
            "illness_needs_client_ids": obj.get("illness_needs_client_ids"),
            "funeral_needs_client_ids": obj.get("funeral_needs_client_ids"),
            "funeral_needs_lump_sum_amount": obj.get("funeral_needs_lump_sum_amount"),
            "funeral_needs_met_by_preexisting": obj.get("funeral_needs_met_by_preexisting"),
            "funeral_needs_justification": obj.get("funeral_needs_justification"),
            "rebroke_decision_advantages_and_disadvantages": obj.get("rebroke_decision_advantages_and_disadvantages"),
            "trust_details": obj.get("trust_details"),
            "client_confirms_terms_exceeding_retirement_affordable": obj.get("client_confirms_terms_exceeding_retirement_affordable"),
            "illness_needs_term_justification": obj.get("illness_needs_term_justification"),
            "length_of_time_payment_without_work": obj.get("length_of_time_payment_without_work") if obj.get("length_of_time_payment_without_work") is not None else CaseProtectionLengthOfTime.INVALID_LENGTH,
            "has_existing_policies": obj.get("has_existing_policies"),
            "has_employee_benefits": obj.get("has_employee_benefits"),
            "suitability_report_recommendation_introduction_protection": obj.get("suitability_report_recommendation_introduction_protection"),
            "additional_budget_details": obj.get("additional_budget_details"),
            "additional_considerations_detail": obj.get("additional_considerations_detail"),
            "death_needs_lump_sum_amount_justification": obj.get("death_needs_lump_sum_amount_justification"),
            "death_needs_income_amount_justification": obj.get("death_needs_income_amount_justification"),
            "illness_needs_income_amount_justification": obj.get("illness_needs_income_amount_justification"),
            "requirements": CdmProtectionRequirements.from_dict(obj["requirements"]) if obj.get("requirements") is not None else None
        })
        return _obj


