# coding: utf-8

"""
    IotaService

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 1.0.0
    Contact: info@affinidi.com
    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 typing import List, Optional, Union
from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, conlist, validator
from affinidi_tdk_iota_client.models.iota_configuration_dto_client_metadata import IotaConfigurationDtoClientMetadata

class IotaConfigurationDto(BaseModel):
    """
    IotaConfigurationDto
    """
    ari: StrictStr = Field(default=..., description="This is a unique resource identifier of the Affinidi Iota Framework configuration.")
    configuration_id: StrictStr = Field(default=..., alias="configurationId", description="ID of the Affinidi Iota Framework configuration.")
    name: StrictStr = Field(default=..., description="The name of the configuration to quickly identify the resource.")
    project_id: StrictStr = Field(default=..., alias="projectId", description="The ID of the project.")
    wallet_ari: StrictStr = Field(default=..., alias="walletAri", description="The unique resource identifier of the Wallet used to sign the request token.")
    token_max_age: Union[StrictFloat, StrictInt] = Field(default=..., alias="tokenMaxAge", description="This is the lifetime of the signed request token during the data-sharing flow.")
    iota_response_webhook_url: Optional[StrictStr] = Field(default=None, alias="iotaResponseWebhookURL", description="The webhook URL is used for callback when the data is ready.")
    enable_verification: StrictBool = Field(default=..., alias="enableVerification", description="Cryptographically verifies the data shared by the user when enabled.")
    enable_consent_audit_log: StrictBool = Field(default=..., alias="enableConsentAuditLog", description="Records the consent the user gave when they shared their data, including the type of data shared.")
    client_metadata: IotaConfigurationDtoClientMetadata = Field(default=..., alias="clientMetadata")
    mode: Optional[StrictStr] = Field(default='websocket', description="Determines whether to handle the data-sharing request using the WebSocket or Redirect flow.")
    redirect_uris: Optional[conlist(StrictStr)] = Field(default=None, alias="redirectUris", description="List of allowed URLs to redirect users, including the response from the request. This is required if the selected data-sharing mode is Redirect.")
    enable_idv_providers: Optional[StrictBool] = Field(default=None, alias="enableIdvProviders", description="Enables identity verification from user with a 3rd-party provider when a verified identity document is not found.")
    __properties = ["ari", "configurationId", "name", "projectId", "walletAri", "tokenMaxAge", "iotaResponseWebhookURL", "enableVerification", "enableConsentAuditLog", "clientMetadata", "mode", "redirectUris", "enableIdvProviders"]

    @validator('mode')
    def mode_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in ('redirect', 'websocket',):
            raise ValueError("must be one of enum values ('redirect', 'websocket')")
        return value

    class Config:
        """Pydantic configuration"""
        allow_population_by_field_name = True
        validate_assignment = True

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

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

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

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True,
                          exclude={
                          },
                          exclude_none=True)
        # override the default output from pydantic by calling `to_dict()` of client_metadata
        if self.client_metadata:
            _dict['clientMetadata'] = self.client_metadata.to_dict()
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> IotaConfigurationDto:
        """Create an instance of IotaConfigurationDto from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return IotaConfigurationDto.parse_obj(obj)

        _obj = IotaConfigurationDto.parse_obj({
            "ari": obj.get("ari"),
            "configuration_id": obj.get("configurationId"),
            "name": obj.get("name"),
            "project_id": obj.get("projectId"),
            "wallet_ari": obj.get("walletAri"),
            "token_max_age": obj.get("tokenMaxAge"),
            "iota_response_webhook_url": obj.get("iotaResponseWebhookURL"),
            "enable_verification": obj.get("enableVerification"),
            "enable_consent_audit_log": obj.get("enableConsentAuditLog"),
            "client_metadata": IotaConfigurationDtoClientMetadata.from_dict(obj.get("clientMetadata")) if obj.get("clientMetadata") is not None else None,
            "mode": obj.get("mode") if obj.get("mode") is not None else 'websocket',
            "redirect_uris": obj.get("redirectUris"),
            "enable_idv_providers": obj.get("enableIdvProviders")
        })
        return _obj


