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

ForexQuote.cs
#region Licence

// 
//                        ######
//                        ######
//  ############    ####( ######  #####. ######  ############   ############
//  #############  #####( ######  #####. ######  #############  #############
//         ######  #####( ######  #####. ######  #####  ######  #####  ######
//  ###### ######  #####( ######  #####. ######  #####  #####   #####  ######
//  ###### ######  #####( ######  #####. ######  #####          #####  ######
//  #############  #############  #############  #############  #####  ######
//   ############   ############  #############   ############  #####  ######
//                                       ######
//                                #############
//                                ############
// 
//  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.Runtime.Serialization;
using System.Text;
using Newtonsoft.Json;

namespace Adyen.Model.Checkout
{
    /// 
    /// ForexQuote
    /// 
    [DataContract]
    public partial clast ForexQuote : IEquatable, IValidatableObject
    {
        /// 
        /// Initializes a new instance of the  clast.
        /// 
        /// The account name..
        /// The account type..
        /// baseAmount.
        /// The base points. (required).
        /// buy.
        /// interbank.
        /// The reference astigned to the forex quote request..
        /// sell.
        /// The signature to validate the integrity..
        /// The source of the forex quote..
        /// The type of forex..
        /// The date until which the forex quote is valid. (required).
        public ForexQuote(string account = default(string), string accountType = default(string),
            Amount baseAmount = default(Amount), int? basePoints = default(int?), Amount buy = default(Amount),
            Amount interbank = default(Amount), string reference = default(string), Amount sell = default(Amount),
            string signature = default(string), string source = default(string), string type = default(string),
            DateTime? validTill = default(DateTime?))
        {
            // to ensure "basePoints" is required (not null)
            if (basePoints == null)
            {
                throw new InvalidDataException("basePoints is a required property for ForexQuote and cannot be null");
            }
            else
            {
                this.BasePoints = basePoints;
            }
            // to ensure "validTill" is required (not null)
            if (validTill == null)
            {
                throw new InvalidDataException("validTill is a required property for ForexQuote and cannot be null");
            }
            else
            {
                this.ValidTill = validTill;
            }
            this.Account = account;
            this.AccountType = accountType;
            this.BaseAmount = baseAmount;
            this.Buy = buy;
            this.Interbank = interbank;
            this.Reference = reference;
            this.Sell = sell;
            this.Signature = signature;
            this.Source = source;
            this.Type = type;
        }

        /// 
        /// The account name.
        /// 
        /// The account name.
        [DataMember(Name = "account", EmitDefaultValue = false)]
        public string Account { get; set; }

        /// 
        /// The account type.
        /// 
        /// The account type.
        [DataMember(Name = "accountType", EmitDefaultValue = false)]
        public string AccountType { get; set; }

        /// 
        /// Gets or Sets BaseAmount
        /// 
        [DataMember(Name = "baseAmount", EmitDefaultValue = false)]
        public Amount BaseAmount { get; set; }

        /// 
        /// The base points.
        /// 
        /// The base points.
        [DataMember(Name = "basePoints", EmitDefaultValue = false)]
        public int? BasePoints { get; set; }

        /// 
        /// Gets or Sets Buy
        /// 
        [DataMember(Name = "buy", EmitDefaultValue = false)]
        public Amount Buy { get; set; }

        /// 
        /// Gets or Sets Interbank
        /// 
        [DataMember(Name = "interbank", EmitDefaultValue = false)]
        public Amount Interbank { get; set; }

        /// 
        /// The reference astigned to the forex quote request.
        /// 
        /// The reference astigned to the forex quote request.
        [DataMember(Name = "reference", EmitDefaultValue = false)]
        public string Reference { get; set; }

        /// 
        /// Gets or Sets Sell
        /// 
        [DataMember(Name = "sell", EmitDefaultValue = false)]
        public Amount Sell { get; set; }

        /// 
        /// The signature to validate the integrity.
        /// 
        /// The signature to validate the integrity.
        [DataMember(Name = "signature", EmitDefaultValue = false)]
        public string Signature { get; set; }

        /// 
        /// The source of the forex quote.
        /// 
        /// The source of the forex quote.
        [DataMember(Name = "source", EmitDefaultValue = false)]
        public string Source { get; set; }

        /// 
        /// The type of forex.
        /// 
        /// The type of forex.
        [DataMember(Name = "type", EmitDefaultValue = false)]
        public string Type { get; set; }

        /// 
        /// The date until which the forex quote is valid.
        /// 
        /// The date until which the forex quote is valid.
        [DataMember(Name = "validTill", EmitDefaultValue = false)]
        public DateTime? ValidTill { 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 ForexQuote {\n");
            sb.Append("  Account: ").Append(Account).Append("\n");
            sb.Append("  AccountType: ").Append(AccountType).Append("\n");
            sb.Append("  BaseAmount: ").Append(BaseAmount).Append("\n");
            sb.Append("  BasePoints: ").Append(BasePoints).Append("\n");
            sb.Append("  Buy: ").Append(Buy).Append("\n");
            sb.Append("  Interbank: ").Append(Interbank).Append("\n");
            sb.Append("  Reference: ").Append(Reference).Append("\n");
            sb.Append("  Sell: ").Append(Sell).Append("\n");
            sb.Append("  Signature: ").Append(Signature).Append("\n");
            sb.Append("  Source: ").Append(Source).Append("\n");
            sb.Append("  Type: ").Append(Type).Append("\n");
            sb.Append("  ValidTill: ").Append(ValidTill).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }

        /// 
        /// Returns the JSON string presentation of the object
        /// 
        /// JSON string presentation of the object
        public virtual 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 ForexQuote);
        }

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

            return
                (
                    this.Account == input.Account ||
                    this.Account != null &&
                    this.Account.Equals(input.Account)
                ) &&
                (
                    this.AccountType == input.AccountType ||
                    this.AccountType != null &&
                    this.AccountType.Equals(input.AccountType)
                ) &&
                (
                    this.BaseAmount == input.BaseAmount ||
                    this.BaseAmount != null &&
                    this.BaseAmount.Equals(input.BaseAmount)
                ) &&
                (
                    this.BasePoints == input.BasePoints ||
                    this.BasePoints != null &&
                    this.BasePoints.Equals(input.BasePoints)
                ) &&
                (
                    this.Buy == input.Buy ||
                    this.Buy != null &&
                    this.Buy.Equals(input.Buy)
                ) &&
                (
                    this.Interbank == input.Interbank ||
                    this.Interbank != null &&
                    this.Interbank.Equals(input.Interbank)
                ) &&
                (
                    this.Reference == input.Reference ||
                    this.Reference != null &&
                    this.Reference.Equals(input.Reference)
                ) &&
                (
                    this.Sell == input.Sell ||
                    this.Sell != null &&
                    this.Sell.Equals(input.Sell)
                ) &&
                (
                    this.Signature == input.Signature ||
                    this.Signature != null &&
                    this.Signature.Equals(input.Signature)
                ) &&
                (
                    this.Source == input.Source ||
                    this.Source != null &&
                    this.Source.Equals(input.Source)
                ) &&
                (
                    this.Type == input.Type ||
                    this.Type != null &&
                    this.Type.Equals(input.Type)
                ) &&
                (
                    this.ValidTill == input.ValidTill ||
                    this.ValidTill != null &&
                    this.ValidTill.Equals(input.ValidTill)
                );
        }

        /// 
        /// Gets the hash code
        /// 
        /// Hash code
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;
                if (this.Account != null)
                    hashCode = hashCode * 59 + this.Account.GetHashCode();
                if (this.AccountType != null)
                    hashCode = hashCode * 59 + this.AccountType.GetHashCode();
                if (this.BaseAmount != null)
                    hashCode = hashCode * 59 + this.BaseAmount.GetHashCode();
                if (this.BasePoints != null)
                    hashCode = hashCode * 59 + this.BasePoints.GetHashCode();
                if (this.Buy != null)
                    hashCode = hashCode * 59 + this.Buy.GetHashCode();
                if (this.Interbank != null)
                    hashCode = hashCode * 59 + this.Interbank.GetHashCode();
                if (this.Reference != null)
                    hashCode = hashCode * 59 + this.Reference.GetHashCode();
                if (this.Sell != null)
                    hashCode = hashCode * 59 + this.Sell.GetHashCode();
                if (this.Signature != null)
                    hashCode = hashCode * 59 + this.Signature.GetHashCode();
                if (this.Source != null)
                    hashCode = hashCode * 59 + this.Source.GetHashCode();
                if (this.Type != null)
                    hashCode = hashCode * 59 + this.Type.GetHashCode();
                if (this.ValidTill != null)
                    hashCode = hashCode * 59 + this.ValidTill.GetHashCode();
                return hashCode;
            }
        }

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