|
| 1 | +from collections.abc import Mapping |
| 2 | +from typing import Any, TypeVar |
| 3 | + |
| 4 | +from attrs import define as _attrs_define |
| 5 | +from attrs import field as _attrs_field |
| 6 | + |
| 7 | +T = TypeVar("T", bound="BasicCalculationResponseItem") |
| 8 | + |
| 9 | + |
| 10 | +@_attrs_define |
| 11 | +class BasicCalculationResponseItem: |
| 12 | + """ |
| 13 | + Attributes: |
| 14 | + loan_interest_rate (float): Loan interest rate |
| 15 | + installment_amount (float): Installment amount |
| 16 | + loan_duration (int): Loan duration |
| 17 | + preference (bool): Preferred maturity of loan offer (max 3) |
| 18 | + main_preference (bool): Main preferred maturity of loan offer (max 1) |
| 19 | + capacity_validity (bool): Loan offer is valid with respect to entered capacity |
| 20 | + rpmn (float): Calculated RPMN |
| 21 | + total_amount (float): Total amount of the order including all fees, insurance, shipping,... Example: 156.95. |
| 22 | + loan_fee (float): |
| 23 | + """ |
| 24 | + |
| 25 | + loan_interest_rate: float |
| 26 | + installment_amount: float |
| 27 | + loan_duration: int |
| 28 | + preference: bool |
| 29 | + main_preference: bool |
| 30 | + capacity_validity: bool |
| 31 | + rpmn: float |
| 32 | + total_amount: float |
| 33 | + loan_fee: float |
| 34 | + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) |
| 35 | + |
| 36 | + def to_dict(self) -> dict[str, Any]: |
| 37 | + loan_interest_rate = self.loan_interest_rate |
| 38 | + |
| 39 | + installment_amount = self.installment_amount |
| 40 | + |
| 41 | + loan_duration = self.loan_duration |
| 42 | + |
| 43 | + preference = self.preference |
| 44 | + |
| 45 | + main_preference = self.main_preference |
| 46 | + |
| 47 | + capacity_validity = self.capacity_validity |
| 48 | + |
| 49 | + rpmn = self.rpmn |
| 50 | + |
| 51 | + total_amount = self.total_amount |
| 52 | + |
| 53 | + loan_fee = self.loan_fee |
| 54 | + |
| 55 | + field_dict: dict[str, Any] = {} |
| 56 | + field_dict.update(self.additional_properties) |
| 57 | + field_dict.update( |
| 58 | + { |
| 59 | + "loanInterestRate": loan_interest_rate, |
| 60 | + "installmentAmount": installment_amount, |
| 61 | + "loanDuration": loan_duration, |
| 62 | + "preference": preference, |
| 63 | + "mainPreference": main_preference, |
| 64 | + "capacityValidity": capacity_validity, |
| 65 | + "rpmn": rpmn, |
| 66 | + "totalAmount": total_amount, |
| 67 | + "loanFee": loan_fee, |
| 68 | + } |
| 69 | + ) |
| 70 | + |
| 71 | + return field_dict |
| 72 | + |
| 73 | + @classmethod |
| 74 | + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: |
| 75 | + d = dict(src_dict) |
| 76 | + loan_interest_rate = d.pop("loanInterestRate") |
| 77 | + |
| 78 | + installment_amount = d.pop("installmentAmount") |
| 79 | + |
| 80 | + loan_duration = d.pop("loanDuration") |
| 81 | + |
| 82 | + preference = d.pop("preference") |
| 83 | + |
| 84 | + main_preference = d.pop("mainPreference") |
| 85 | + |
| 86 | + capacity_validity = d.pop("capacityValidity") |
| 87 | + |
| 88 | + rpmn = d.pop("rpmn") |
| 89 | + |
| 90 | + total_amount = d.pop("totalAmount") |
| 91 | + |
| 92 | + loan_fee = d.pop("loanFee") |
| 93 | + |
| 94 | + basic_calculation_response_item = cls( |
| 95 | + loan_interest_rate=loan_interest_rate, |
| 96 | + installment_amount=installment_amount, |
| 97 | + loan_duration=loan_duration, |
| 98 | + preference=preference, |
| 99 | + main_preference=main_preference, |
| 100 | + capacity_validity=capacity_validity, |
| 101 | + rpmn=rpmn, |
| 102 | + total_amount=total_amount, |
| 103 | + loan_fee=loan_fee, |
| 104 | + ) |
| 105 | + |
| 106 | + basic_calculation_response_item.additional_properties = d |
| 107 | + return basic_calculation_response_item |
| 108 | + |
| 109 | + @property |
| 110 | + def additional_keys(self) -> list[str]: |
| 111 | + return list(self.additional_properties.keys()) |
| 112 | + |
| 113 | + def __getitem__(self, key: str) -> Any: |
| 114 | + return self.additional_properties[key] |
| 115 | + |
| 116 | + def __setitem__(self, key: str, value: Any) -> None: |
| 117 | + self.additional_properties[key] = value |
| 118 | + |
| 119 | + def __delitem__(self, key: str) -> None: |
| 120 | + del self.additional_properties[key] |
| 121 | + |
| 122 | + def __contains__(self, key: str) -> bool: |
| 123 | + return key in self.additional_properties |
0 commit comments