# coding: utf-8
"""
LUSID API
FINBOURNE Technology # noqa: E501
Contact: info@finbourne.com
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
"""
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from typing import List, Dict, Optional, Any, Union, TYPE_CHECKING
from typing_extensions import Annotated
from pydantic.v1 import BaseModel, StrictStr, StrictInt, StrictBool, StrictFloat, StrictBytes, Field, validator, ValidationError, conlist, constr
from datetime import datetime
[docs]
class AddressDefinition(BaseModel):
"""
AddressDefinition
"""
display_name: Optional[StrictStr] = Field(None,alias="displayName", description="The display name of the address key.")
type: Optional[StrictStr] = Field(None,alias="type", description="Available values: String, Int, Decimal, DateTime, Boolean, ResultValue, Result0D, Json.")
description: Optional[StrictStr] = Field(None,alias="description", description="The description for this result.")
life_cycle_status: Optional[StrictStr] = Field(None,alias="lifeCycleStatus", description="What is the status of the address path. If it is not Production then it might be removed at some point in the future. See the removal date for the likely timing of that if any.")
removal_date: Optional[datetime] = Field(default=None, description="If the life-cycle status of the address is Deprecated then this is the date at which support of the address will be suspended. After that date it will be removed at the earliest possible point subject to any specific contractual support and development constraints.", alias="removalDate")
documentation_link: Optional[StrictStr] = Field(None,alias="documentationLink", description="Contains a link to the documentation for this AddressDefinition in KnowledgeBase.")
__properties = ["displayName", "type", "description", "lifeCycleStatus", "removalDate", "documentationLink"]
[docs]
@validator('type')
def type_validate_enum(cls, value):
"""Validates the enum"""
# Finbourne have removed enum validation on all models, except for this use case:
# Workflow and notification application SDK use the property name 'type' as the discriminator on a number of classes.
# During instantiation, the value of 'type' is checked against the enum values,
# check it's a class that uses the 'type' property as a discriminator
# list of classes can be found by searching for 'actual_instance: Union[' in the generated code
if 'AddressDefinition' not in [
# For notification application classes
'AmazonSqsNotificationType',
'AmazonSqsNotificationTypeResponse',
'AmazonSqsPrincipalAuthNotificationType',
'AmazonSqsPrincipalAuthNotificationTypeResponse',
'AzureServiceBusTypeResponse',
'AzureServiceBusNotificationType',
'EmailNotificationType',
'EmailNotificationTypeResponse',
'SmsNotificationType',
'SmsNotificationTypeResponse',
'WebhookNotificationType',
'WebhookNotificationTypeResponse',
# For workflow application classes
'CreateChildTasksAction',
'RunWorkerAction',
'TriggerParentTaskAction',
'CreateChildTasksActionResponse',
'RunWorkerActionResponse',
'TriggerChildTasksAction',
'TriggerChildTasksActionResponse',
'TriggerParentTaskActionResponse',
'CreateNewTaskActivity',
'UpdateMatchingTasksActivity',
'CreateNewTaskActivityResponse',
'UpdateMatchingTasksActivityResponse',
'Fail',
'GroupReconciliation',
'HealthCheck',
'LuminesceView',
'SchedulerJob',
'Sleep',
'FailResponse',
'GroupReconciliationResponse',
'HealthCheckResponse',
'LuminesceViewResponse',
'SchedulerJobResponse',
'SleepResponse',
'Library',
'LibraryResponse',
'DayRegularity',
'RelativeMonthRegularity',
'SpecificMonthRegularity',
'WeekRegularity',
'YearRegularity',
'LusidEntityDataQualityCheck',
'LusidEntityDataQualityCheckResponse',
'TriggerChildTasksActionResponse']:
return value
# Only validate the 'type' property of the class
if "type" != "type":
return value
if value is None:
return value
if value not in ['String', 'Int', 'Decimal', 'DateTime', 'Boolean', 'ResultValue', 'Result0D', 'Json']:
raise ValueError("must be one of enum values ('String', 'Int', 'Decimal', 'DateTime', 'Boolean', 'ResultValue', 'Result0D', 'Json')")
return value
[docs]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
def __str__(self):
"""For `print` and `pprint`"""
return pprint.pformat(self.dict(by_alias=False))
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
[docs]
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
[docs]
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
return json.dumps(self.to_dict())
[docs]
@classmethod
def from_json(cls, json_str: str) -> AddressDefinition:
"""Create an instance of AddressDefinition from a JSON string"""
return cls.from_dict(json.loads(json_str))
[docs]
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
exclude={
},
exclude_none=True)
# set to None if display_name (nullable) is None
# and __fields_set__ contains the field
if self.display_name is None and "display_name" in self.__fields_set__:
_dict['displayName'] = None
# set to None if description (nullable) is None
# and __fields_set__ contains the field
if self.description is None and "description" in self.__fields_set__:
_dict['description'] = None
# set to None if life_cycle_status (nullable) is None
# and __fields_set__ contains the field
if self.life_cycle_status is None and "life_cycle_status" in self.__fields_set__:
_dict['lifeCycleStatus'] = None
# set to None if removal_date (nullable) is None
# and __fields_set__ contains the field
if self.removal_date is None and "removal_date" in self.__fields_set__:
_dict['removalDate'] = None
# set to None if documentation_link (nullable) is None
# and __fields_set__ contains the field
if self.documentation_link is None and "documentation_link" in self.__fields_set__:
_dict['documentationLink'] = None
return _dict
[docs]
@classmethod
def from_dict(cls, obj: dict) -> AddressDefinition:
"""Create an instance of AddressDefinition from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return AddressDefinition.parse_obj(obj)
_obj = AddressDefinition.parse_obj({
"display_name": obj.get("displayName"),
"type": obj.get("type"),
"description": obj.get("description"),
"life_cycle_status": obj.get("lifeCycleStatus"),
"removal_date": obj.get("removalDate"),
"documentation_link": obj.get("documentationLink")
})
return _obj
AddressDefinition.update_forward_refs()