|
| 1 | +/** |
| 2 | + * This file was auto-generated by Fern from our API Definition. |
| 3 | + */ |
| 4 | +package com.flagright.api.types; |
| 5 | + |
| 6 | +import com.fasterxml.jackson.annotation.JsonAnyGetter; |
| 7 | +import com.fasterxml.jackson.annotation.JsonAnySetter; |
| 8 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 9 | +import com.fasterxml.jackson.annotation.JsonInclude; |
| 10 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 11 | +import com.fasterxml.jackson.annotation.JsonSetter; |
| 12 | +import com.fasterxml.jackson.annotation.Nulls; |
| 13 | +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
| 14 | +import com.flagright.api.core.ObjectMappers; |
| 15 | +import java.util.HashMap; |
| 16 | +import java.util.List; |
| 17 | +import java.util.Map; |
| 18 | +import java.util.Objects; |
| 19 | +import java.util.Optional; |
| 20 | + |
| 21 | +@JsonInclude(JsonInclude.Include.NON_ABSENT) |
| 22 | +@JsonDeserialize(builder = BlockchainRisk.Builder.class) |
| 23 | +public final class BlockchainRisk { |
| 24 | + private final Optional<String> provider; |
| 25 | + |
| 26 | + private final Optional<RiskLevel> riskLevel; |
| 27 | + |
| 28 | + private final Optional<Double> riskScore; |
| 29 | + |
| 30 | + private final Optional<List<BlockchainCounterparty>> counterparties; |
| 31 | + |
| 32 | + private final Optional<BlockchainRiskSubject> subject; |
| 33 | + |
| 34 | + private final Optional<List<BlockchainRiskDetail>> risks; |
| 35 | + |
| 36 | + private final Map<String, Object> additionalProperties; |
| 37 | + |
| 38 | + private BlockchainRisk( |
| 39 | + Optional<String> provider, |
| 40 | + Optional<RiskLevel> riskLevel, |
| 41 | + Optional<Double> riskScore, |
| 42 | + Optional<List<BlockchainCounterparty>> counterparties, |
| 43 | + Optional<BlockchainRiskSubject> subject, |
| 44 | + Optional<List<BlockchainRiskDetail>> risks, |
| 45 | + Map<String, Object> additionalProperties) { |
| 46 | + this.provider = provider; |
| 47 | + this.riskLevel = riskLevel; |
| 48 | + this.riskScore = riskScore; |
| 49 | + this.counterparties = counterparties; |
| 50 | + this.subject = subject; |
| 51 | + this.risks = risks; |
| 52 | + this.additionalProperties = additionalProperties; |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * @return Risk analysis provider (e.g., chainalysis) |
| 57 | + */ |
| 58 | + @JsonProperty("provider") |
| 59 | + public Optional<String> getProvider() { |
| 60 | + return provider; |
| 61 | + } |
| 62 | + |
| 63 | + /** |
| 64 | + * @return Overall risk level of the transaction |
| 65 | + */ |
| 66 | + @JsonProperty("riskLevel") |
| 67 | + public Optional<RiskLevel> getRiskLevel() { |
| 68 | + return riskLevel; |
| 69 | + } |
| 70 | + |
| 71 | + /** |
| 72 | + * @return Numeric risk score from 0 to 100 |
| 73 | + */ |
| 74 | + @JsonProperty("riskScore") |
| 75 | + public Optional<Double> getRiskScore() { |
| 76 | + return riskScore; |
| 77 | + } |
| 78 | + |
| 79 | + /** |
| 80 | + * @return List of counterparties involved in the transaction |
| 81 | + */ |
| 82 | + @JsonProperty("counterparties") |
| 83 | + public Optional<List<BlockchainCounterparty>> getCounterparties() { |
| 84 | + return counterparties; |
| 85 | + } |
| 86 | + |
| 87 | + /** |
| 88 | + * @return Subject of the risk analysis (address, transaction, entity, or smart contract) |
| 89 | + */ |
| 90 | + @JsonProperty("subject") |
| 91 | + public Optional<BlockchainRiskSubject> getSubject() { |
| 92 | + return subject; |
| 93 | + } |
| 94 | + |
| 95 | + /** |
| 96 | + * @return Detailed risk categories and their analysis |
| 97 | + */ |
| 98 | + @JsonProperty("risks") |
| 99 | + public Optional<List<BlockchainRiskDetail>> getRisks() { |
| 100 | + return risks; |
| 101 | + } |
| 102 | + |
| 103 | + @java.lang.Override |
| 104 | + public boolean equals(Object other) { |
| 105 | + if (this == other) return true; |
| 106 | + return other instanceof BlockchainRisk && equalTo((BlockchainRisk) other); |
| 107 | + } |
| 108 | + |
| 109 | + @JsonAnyGetter |
| 110 | + public Map<String, Object> getAdditionalProperties() { |
| 111 | + return this.additionalProperties; |
| 112 | + } |
| 113 | + |
| 114 | + private boolean equalTo(BlockchainRisk other) { |
| 115 | + return provider.equals(other.provider) |
| 116 | + && riskLevel.equals(other.riskLevel) |
| 117 | + && riskScore.equals(other.riskScore) |
| 118 | + && counterparties.equals(other.counterparties) |
| 119 | + && subject.equals(other.subject) |
| 120 | + && risks.equals(other.risks); |
| 121 | + } |
| 122 | + |
| 123 | + @java.lang.Override |
| 124 | + public int hashCode() { |
| 125 | + return Objects.hash( |
| 126 | + this.provider, this.riskLevel, this.riskScore, this.counterparties, this.subject, this.risks); |
| 127 | + } |
| 128 | + |
| 129 | + @java.lang.Override |
| 130 | + public String toString() { |
| 131 | + return ObjectMappers.stringify(this); |
| 132 | + } |
| 133 | + |
| 134 | + public static Builder builder() { |
| 135 | + return new Builder(); |
| 136 | + } |
| 137 | + |
| 138 | + @JsonIgnoreProperties(ignoreUnknown = true) |
| 139 | + public static final class Builder { |
| 140 | + private Optional<String> provider = Optional.empty(); |
| 141 | + |
| 142 | + private Optional<RiskLevel> riskLevel = Optional.empty(); |
| 143 | + |
| 144 | + private Optional<Double> riskScore = Optional.empty(); |
| 145 | + |
| 146 | + private Optional<List<BlockchainCounterparty>> counterparties = Optional.empty(); |
| 147 | + |
| 148 | + private Optional<BlockchainRiskSubject> subject = Optional.empty(); |
| 149 | + |
| 150 | + private Optional<List<BlockchainRiskDetail>> risks = Optional.empty(); |
| 151 | + |
| 152 | + @JsonAnySetter |
| 153 | + private Map<String, Object> additionalProperties = new HashMap<>(); |
| 154 | + |
| 155 | + private Builder() {} |
| 156 | + |
| 157 | + public Builder from(BlockchainRisk other) { |
| 158 | + provider(other.getProvider()); |
| 159 | + riskLevel(other.getRiskLevel()); |
| 160 | + riskScore(other.getRiskScore()); |
| 161 | + counterparties(other.getCounterparties()); |
| 162 | + subject(other.getSubject()); |
| 163 | + risks(other.getRisks()); |
| 164 | + return this; |
| 165 | + } |
| 166 | + |
| 167 | + @JsonSetter(value = "provider", nulls = Nulls.SKIP) |
| 168 | + public Builder provider(Optional<String> provider) { |
| 169 | + this.provider = provider; |
| 170 | + return this; |
| 171 | + } |
| 172 | + |
| 173 | + public Builder provider(String provider) { |
| 174 | + this.provider = Optional.ofNullable(provider); |
| 175 | + return this; |
| 176 | + } |
| 177 | + |
| 178 | + @JsonSetter(value = "riskLevel", nulls = Nulls.SKIP) |
| 179 | + public Builder riskLevel(Optional<RiskLevel> riskLevel) { |
| 180 | + this.riskLevel = riskLevel; |
| 181 | + return this; |
| 182 | + } |
| 183 | + |
| 184 | + public Builder riskLevel(RiskLevel riskLevel) { |
| 185 | + this.riskLevel = Optional.ofNullable(riskLevel); |
| 186 | + return this; |
| 187 | + } |
| 188 | + |
| 189 | + @JsonSetter(value = "riskScore", nulls = Nulls.SKIP) |
| 190 | + public Builder riskScore(Optional<Double> riskScore) { |
| 191 | + this.riskScore = riskScore; |
| 192 | + return this; |
| 193 | + } |
| 194 | + |
| 195 | + public Builder riskScore(Double riskScore) { |
| 196 | + this.riskScore = Optional.ofNullable(riskScore); |
| 197 | + return this; |
| 198 | + } |
| 199 | + |
| 200 | + @JsonSetter(value = "counterparties", nulls = Nulls.SKIP) |
| 201 | + public Builder counterparties(Optional<List<BlockchainCounterparty>> counterparties) { |
| 202 | + this.counterparties = counterparties; |
| 203 | + return this; |
| 204 | + } |
| 205 | + |
| 206 | + public Builder counterparties(List<BlockchainCounterparty> counterparties) { |
| 207 | + this.counterparties = Optional.ofNullable(counterparties); |
| 208 | + return this; |
| 209 | + } |
| 210 | + |
| 211 | + @JsonSetter(value = "subject", nulls = Nulls.SKIP) |
| 212 | + public Builder subject(Optional<BlockchainRiskSubject> subject) { |
| 213 | + this.subject = subject; |
| 214 | + return this; |
| 215 | + } |
| 216 | + |
| 217 | + public Builder subject(BlockchainRiskSubject subject) { |
| 218 | + this.subject = Optional.ofNullable(subject); |
| 219 | + return this; |
| 220 | + } |
| 221 | + |
| 222 | + @JsonSetter(value = "risks", nulls = Nulls.SKIP) |
| 223 | + public Builder risks(Optional<List<BlockchainRiskDetail>> risks) { |
| 224 | + this.risks = risks; |
| 225 | + return this; |
| 226 | + } |
| 227 | + |
| 228 | + public Builder risks(List<BlockchainRiskDetail> risks) { |
| 229 | + this.risks = Optional.ofNullable(risks); |
| 230 | + return this; |
| 231 | + } |
| 232 | + |
| 233 | + public BlockchainRisk build() { |
| 234 | + return new BlockchainRisk( |
| 235 | + provider, riskLevel, riskScore, counterparties, subject, risks, additionalProperties); |
| 236 | + } |
| 237 | + } |
| 238 | +} |
0 commit comments