|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | + Onfido API v3.6 |
| 5 | +
|
| 6 | + The Onfido API (v3.6) |
| 7 | +
|
| 8 | + The version of the OpenAPI document: v3.6 |
| 9 | + Generated by OpenAPI Generator (https://openapi-generator.tech) |
| 10 | +
|
| 11 | + Do not edit the class manually. |
| 12 | +""" # noqa: E501 |
| 13 | + |
| 14 | + |
| 15 | +from __future__ import annotations |
| 16 | +import pprint |
| 17 | +import re # noqa: F401 |
| 18 | +import json |
| 19 | + |
| 20 | +from pydantic import BaseModel, ConfigDict |
| 21 | +from typing import Any, ClassVar, Dict, List, Optional |
| 22 | +from onfido.models.report_configuration_facial_similarity import ReportConfigurationFacialSimilarity |
| 23 | +from typing import Optional, Set |
| 24 | +from typing_extensions import Self |
| 25 | + |
| 26 | +class ReportConfiguration(BaseModel): |
| 27 | + """ |
| 28 | + Defines configuration options for facial similarity checks used to distinguish between onboarding and reverification scenarios. |
| 29 | + """ # noqa: E501 |
| 30 | + facial_similarity_photo: Optional[ReportConfigurationFacialSimilarity] = None |
| 31 | + facial_similarity_photo_fully_auto: Optional[ReportConfigurationFacialSimilarity] = None |
| 32 | + facial_similarity_video: Optional[ReportConfigurationFacialSimilarity] = None |
| 33 | + facial_similarity_motion: Optional[ReportConfigurationFacialSimilarity] = None |
| 34 | + additional_properties: Dict[str, Any] = {} |
| 35 | + __properties: ClassVar[List[str]] = ["facial_similarity_photo", "facial_similarity_photo_fully_auto", "facial_similarity_video", "facial_similarity_motion"] |
| 36 | + |
| 37 | + model_config = ConfigDict( |
| 38 | + populate_by_name=True, |
| 39 | + validate_assignment=True, |
| 40 | + protected_namespaces=(), |
| 41 | + ) |
| 42 | + |
| 43 | + |
| 44 | + def to_str(self) -> str: |
| 45 | + """Returns the string representation of the model using alias""" |
| 46 | + return pprint.pformat(self.model_dump(by_alias=True)) |
| 47 | + |
| 48 | + def to_json(self) -> str: |
| 49 | + """Returns the JSON representation of the model using alias""" |
| 50 | + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead |
| 51 | + return json.dumps(self.to_dict()) |
| 52 | + |
| 53 | + @classmethod |
| 54 | + def from_json(cls, json_str: str) -> Optional[Self]: |
| 55 | + """Create an instance of ReportConfiguration from a JSON string""" |
| 56 | + return cls.from_dict(json.loads(json_str)) |
| 57 | + |
| 58 | + def to_dict(self) -> Dict[str, Any]: |
| 59 | + """Return the dictionary representation of the model using alias. |
| 60 | +
|
| 61 | + This has the following differences from calling pydantic's |
| 62 | + `self.model_dump(by_alias=True)`: |
| 63 | +
|
| 64 | + * `None` is only added to the output dict for nullable fields that |
| 65 | + were set at model initialization. Other fields with value `None` |
| 66 | + are ignored. |
| 67 | + * Fields in `self.additional_properties` are added to the output dict. |
| 68 | + """ |
| 69 | + excluded_fields: Set[str] = set([ |
| 70 | + "additional_properties", |
| 71 | + ]) |
| 72 | + |
| 73 | + _dict = self.model_dump( |
| 74 | + by_alias=True, |
| 75 | + exclude=excluded_fields, |
| 76 | + exclude_none=True, |
| 77 | + ) |
| 78 | + # override the default output from pydantic by calling `to_dict()` of facial_similarity_photo |
| 79 | + if self.facial_similarity_photo: |
| 80 | + _dict['facial_similarity_photo'] = self.facial_similarity_photo.to_dict() |
| 81 | + # override the default output from pydantic by calling `to_dict()` of facial_similarity_photo_fully_auto |
| 82 | + if self.facial_similarity_photo_fully_auto: |
| 83 | + _dict['facial_similarity_photo_fully_auto'] = self.facial_similarity_photo_fully_auto.to_dict() |
| 84 | + # override the default output from pydantic by calling `to_dict()` of facial_similarity_video |
| 85 | + if self.facial_similarity_video: |
| 86 | + _dict['facial_similarity_video'] = self.facial_similarity_video.to_dict() |
| 87 | + # override the default output from pydantic by calling `to_dict()` of facial_similarity_motion |
| 88 | + if self.facial_similarity_motion: |
| 89 | + _dict['facial_similarity_motion'] = self.facial_similarity_motion.to_dict() |
| 90 | + # puts key-value pairs in additional_properties in the top level |
| 91 | + if self.additional_properties is not None: |
| 92 | + for _key, _value in self.additional_properties.items(): |
| 93 | + _dict[_key] = _value |
| 94 | + |
| 95 | + return _dict |
| 96 | + |
| 97 | + @classmethod |
| 98 | + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: |
| 99 | + """Create an instance of ReportConfiguration from a dict""" |
| 100 | + if obj is None: |
| 101 | + return None |
| 102 | + |
| 103 | + if not isinstance(obj, dict): |
| 104 | + return cls.model_validate(obj) |
| 105 | + |
| 106 | + _obj = cls.model_validate({ |
| 107 | + "facial_similarity_photo": ReportConfigurationFacialSimilarity.from_dict(obj["facial_similarity_photo"]) if obj.get("facial_similarity_photo") is not None else None, |
| 108 | + "facial_similarity_photo_fully_auto": ReportConfigurationFacialSimilarity.from_dict(obj["facial_similarity_photo_fully_auto"]) if obj.get("facial_similarity_photo_fully_auto") is not None else None, |
| 109 | + "facial_similarity_video": ReportConfigurationFacialSimilarity.from_dict(obj["facial_similarity_video"]) if obj.get("facial_similarity_video") is not None else None, |
| 110 | + "facial_similarity_motion": ReportConfigurationFacialSimilarity.from_dict(obj["facial_similarity_motion"]) if obj.get("facial_similarity_motion") is not None else None |
| 111 | + }) |
| 112 | + # store additional fields in additional_properties |
| 113 | + for _key in obj.keys(): |
| 114 | + if _key not in cls.__properties: |
| 115 | + _obj.additional_properties[_key] = obj.get(_key) |
| 116 | + |
| 117 | + return _obj |
| 118 | + |
| 119 | + |
0 commit comments