csharp/Adyen/adyen-dotnet-api-library/Adyen/Model/Checkout/FraudResult.cs

FraudResult.cs
#region License
// /*
//  *                       ######
//  *                       ######
//  * ############    ####( ######  #####. ######  ############   ############
//  * #############  #####( ######  #####. ######  #############  #############
//  *        ######  #####( ######  #####. ######  #####  ######  #####  ######
//  * ###### ######  #####( ######  #####. ######  #####  #####   #####  ######
//  * ###### ######  #####( ######  #####. ######  #####          #####  ######
//  * #############  #############  #############  #############  #####  ######
//  *  ############   ############  #############   ############  #####  ######
//  *                                      ######
//  *                               #############
//  *                               ############
//  *
//  * Adyen Dotnet API Library
//  *
//  * Copyright (c) 2020 Adyen B.V.
//  * This file is open source and available under the MIT license.
//  * See the LICENSE file for more info.
//  */
#endregion

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using Adyen.Util;
using Newtonsoft.Json;

namespace Adyen.Model.Checkout
{
    /// 
    /// FraudResult
    /// 
    [DataContract]
    public partial clast FraudResult : IEquatable, IValidatableObject
    {
        /// 
        /// Initializes a new instance of the  clast.
        /// 
        /// The total fraud score generated by the risk checks. (required).
        /// The result of the individual risk checks..
        public FraudResult(int? AccountScore = default(int?), List Results = default(List))
        {
            // to ensure "AccountScore" is required (not null)
            if (AccountScore == null)
            {
                throw new InvalidDataException("AccountScore is a required property for FraudResult and cannot be null");
            }
            else
            {
                this.AccountScore = AccountScore;
            }
            this.Results = Results;
        }

        /// 
        /// The total fraud score generated by the risk checks.
        /// 
        /// The total fraud score generated by the risk checks.
        [DataMember(Name = "accountScore", EmitDefaultValue = false)]
        public int? AccountScore { get; set; }

        /// 
        /// The result of the individual risk checks.
        /// 
        /// The result of the individual risk checks.
        [DataMember(Name = "results", EmitDefaultValue = false)]
        public List Results { get; set; }

        /// 
        /// Returns the string presentation of the object
        /// 
        /// String presentation of the object
        public override string ToString()
        {
            var sb = new StringBuilder();
            sb.Append("clast FraudResult {\n");
            sb.Append("  AccountScore: ").Append(AccountScore).Append("\n");
            sb.Append("  Results: ").Append(Results.ObjectListToString()).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }

        /// 
        /// Returns the JSON string presentation of the object
        /// 
        /// JSON string presentation of the object
        public string ToJson()
        {
            return JsonConvert.SerializeObject(this, Formatting.Indented);
        }

        /// 
        /// Returns true if objects are equal
        /// 
        /// Object to be compared
        /// Boolean
        public override bool Equals(object input)
        {
            return this.Equals(input as FraudResult);
        }

        /// 
        /// Returns true if FraudResult instances are equal
        /// 
        /// Instance of FraudResult to be compared
        /// Boolean
        public bool Equals(FraudResult input)
        {
            if (input == null)
                return false;

            return
                (
                    this.AccountScore == input.AccountScore ||
                    (this.AccountScore != null &&
                    this.AccountScore.Equals(input.AccountScore))
                ) &&
                (
                    this.Results == input.Results ||
                    this.Results != null &&
                    this.Results.SequenceEqual(input.Results)
                );
        }

        /// 
        /// Gets the hash code
        /// 
        /// Hash code
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;
                if (this.AccountScore != null)
                    hashCode = hashCode * 59 + this.AccountScore.GetHashCode();
                if (this.Results != null)
                    hashCode = hashCode * 59 + this.Results.GetHashCode();
                return hashCode;
            }
        }

        /// 
        /// To validate all properties of the instance
        /// 
        /// Validation context
        /// Validation Result
        IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
        {
            yield break;
        }
    }

}