/*
 * Tribufu API
 *
 * API to access Tribufu services.
 *
 * The version of the OpenAPI document: 1.2.6
 * Contact: contact@tribufu.com
 * Generated by: https://github.com/openapitools/openapi-generator.git
 */


using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;

namespace Tribufu.Model
{
    /// <summary>
    /// IpAddress
    /// </summary>
    [DataContract(Name = "IpAddress")]
    public partial class IpAddress : IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="IpAddress" /> class.
        /// </summary>
        /// <param name="address">address.</param>
        /// <param name="varVersion">varVersion.</param>
        /// <param name="network">network.</param>
        /// <param name="reserved">reserved.</param>
        /// <param name="asn">asn.</param>
        /// <param name="isp">isp.</param>
        /// <param name="continent">continent.</param>
        /// <param name="country">country.</param>
        /// <param name="region">region.</param>
        /// <param name="city">city.</param>
        /// <param name="postalCode">postalCode.</param>
        /// <param name="callingCode">callingCode.</param>
        /// <param name="tld">tld.</param>
        /// <param name="language">language.</param>
        /// <param name="timezone">timezone.</param>
        /// <param name="currency">currency.</param>
        /// <param name="latitude">latitude.</param>
        /// <param name="longitude">longitude.</param>
        public IpAddress(string address = default(string), int varVersion = default(int), string network = default(string), bool reserved = default(bool), string asn = default(string), string isp = default(string), string continent = default(string), string country = default(string), string region = default(string), string city = default(string), string postalCode = default(string), string callingCode = default(string), string tld = default(string), string language = default(string), string timezone = default(string), string currency = default(string), float? latitude = default(float?), float? longitude = default(float?))
        {
            this.Address = address;
            this.VarVersion = varVersion;
            this.Network = network;
            this.Reserved = reserved;
            this.Asn = asn;
            this.Isp = isp;
            this.Continent = continent;
            this.Country = country;
            this.Region = region;
            this.City = city;
            this.PostalCode = postalCode;
            this.CallingCode = callingCode;
            this.Tld = tld;
            this.Language = language;
            this.Timezone = timezone;
            this.Currency = currency;
            this.Latitude = latitude;
            this.Longitude = longitude;
        }

        /// <summary>
        /// Gets or Sets Address
        /// </summary>
        [DataMember(Name = "address", EmitDefaultValue = true)]
        public string Address { get; set; }

        /// <summary>
        /// Gets or Sets VarVersion
        /// </summary>
        [DataMember(Name = "version", EmitDefaultValue = false)]
        public int VarVersion { get; set; }

        /// <summary>
        /// Gets or Sets Network
        /// </summary>
        [DataMember(Name = "network", EmitDefaultValue = true)]
        public string Network { get; set; }

        /// <summary>
        /// Gets or Sets Reserved
        /// </summary>
        [DataMember(Name = "reserved", EmitDefaultValue = true)]
        public bool Reserved { get; set; }

        /// <summary>
        /// Gets or Sets Asn
        /// </summary>
        [DataMember(Name = "asn", EmitDefaultValue = true)]
        public string Asn { get; set; }

        /// <summary>
        /// Gets or Sets Isp
        /// </summary>
        [DataMember(Name = "isp", EmitDefaultValue = true)]
        public string Isp { get; set; }

        /// <summary>
        /// Gets or Sets Continent
        /// </summary>
        [DataMember(Name = "continent", EmitDefaultValue = true)]
        public string Continent { get; set; }

        /// <summary>
        /// Gets or Sets Country
        /// </summary>
        [DataMember(Name = "country", EmitDefaultValue = true)]
        public string Country { get; set; }

        /// <summary>
        /// Gets or Sets Region
        /// </summary>
        [DataMember(Name = "region", EmitDefaultValue = true)]
        public string Region { get; set; }

        /// <summary>
        /// Gets or Sets City
        /// </summary>
        [DataMember(Name = "city", EmitDefaultValue = true)]
        public string City { get; set; }

        /// <summary>
        /// Gets or Sets PostalCode
        /// </summary>
        [DataMember(Name = "postal_code", EmitDefaultValue = true)]
        public string PostalCode { get; set; }

        /// <summary>
        /// Gets or Sets CallingCode
        /// </summary>
        [DataMember(Name = "calling_code", EmitDefaultValue = true)]
        public string CallingCode { get; set; }

        /// <summary>
        /// Gets or Sets Tld
        /// </summary>
        [DataMember(Name = "tld", EmitDefaultValue = true)]
        public string Tld { get; set; }

        /// <summary>
        /// Gets or Sets Language
        /// </summary>
        [DataMember(Name = "language", EmitDefaultValue = true)]
        public string Language { get; set; }

        /// <summary>
        /// Gets or Sets Timezone
        /// </summary>
        [DataMember(Name = "timezone", EmitDefaultValue = true)]
        public string Timezone { get; set; }

        /// <summary>
        /// Gets or Sets Currency
        /// </summary>
        [DataMember(Name = "currency", EmitDefaultValue = true)]
        public string Currency { get; set; }

        /// <summary>
        /// Gets or Sets Latitude
        /// </summary>
        [DataMember(Name = "latitude", EmitDefaultValue = true)]
        public float? Latitude { get; set; }

        /// <summary>
        /// Gets or Sets Longitude
        /// </summary>
        [DataMember(Name = "longitude", EmitDefaultValue = true)]
        public float? Longitude { get; set; }

        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("class IpAddress {\n");
            sb.Append("  Address: ").Append(Address).Append("\n");
            sb.Append("  VarVersion: ").Append(VarVersion).Append("\n");
            sb.Append("  Network: ").Append(Network).Append("\n");
            sb.Append("  Reserved: ").Append(Reserved).Append("\n");
            sb.Append("  Asn: ").Append(Asn).Append("\n");
            sb.Append("  Isp: ").Append(Isp).Append("\n");
            sb.Append("  Continent: ").Append(Continent).Append("\n");
            sb.Append("  Country: ").Append(Country).Append("\n");
            sb.Append("  Region: ").Append(Region).Append("\n");
            sb.Append("  City: ").Append(City).Append("\n");
            sb.Append("  PostalCode: ").Append(PostalCode).Append("\n");
            sb.Append("  CallingCode: ").Append(CallingCode).Append("\n");
            sb.Append("  Tld: ").Append(Tld).Append("\n");
            sb.Append("  Language: ").Append(Language).Append("\n");
            sb.Append("  Timezone: ").Append(Timezone).Append("\n");
            sb.Append("  Currency: ").Append(Currency).Append("\n");
            sb.Append("  Latitude: ").Append(Latitude).Append("\n");
            sb.Append("  Longitude: ").Append(Longitude).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }

        /// <summary>
        /// Returns the JSON string presentation of the object
        /// </summary>
        /// <returns>JSON string presentation of the object</returns>
        public virtual string ToJson()
        {
            return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
        }

        /// <summary>
        /// To validate all properties of the instance
        /// </summary>
        /// <param name="validationContext">Validation context</param>
        /// <returns>Validation Result</returns>
        IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            // Address (string) maxLength
            if (this.Address != null && this.Address.Length > 255)
            {
                yield return new ValidationResult("Invalid value for Address, length must be less than 255.", new [] { "Address" });
            }

            // Network (string) maxLength
            if (this.Network != null && this.Network.Length > 255)
            {
                yield return new ValidationResult("Invalid value for Network, length must be less than 255.", new [] { "Network" });
            }

            // Asn (string) maxLength
            if (this.Asn != null && this.Asn.Length > 10)
            {
                yield return new ValidationResult("Invalid value for Asn, length must be less than 10.", new [] { "Asn" });
            }

            // Isp (string) maxLength
            if (this.Isp != null && this.Isp.Length > 255)
            {
                yield return new ValidationResult("Invalid value for Isp, length must be less than 255.", new [] { "Isp" });
            }

            // Continent (string) maxLength
            if (this.Continent != null && this.Continent.Length > 2)
            {
                yield return new ValidationResult("Invalid value for Continent, length must be less than 2.", new [] { "Continent" });
            }

            // Country (string) maxLength
            if (this.Country != null && this.Country.Length > 2)
            {
                yield return new ValidationResult("Invalid value for Country, length must be less than 2.", new [] { "Country" });
            }

            // Region (string) maxLength
            if (this.Region != null && this.Region.Length > 255)
            {
                yield return new ValidationResult("Invalid value for Region, length must be less than 255.", new [] { "Region" });
            }

            // City (string) maxLength
            if (this.City != null && this.City.Length > 255)
            {
                yield return new ValidationResult("Invalid value for City, length must be less than 255.", new [] { "City" });
            }

            // PostalCode (string) maxLength
            if (this.PostalCode != null && this.PostalCode.Length > 45)
            {
                yield return new ValidationResult("Invalid value for PostalCode, length must be less than 45.", new [] { "PostalCode" });
            }

            // CallingCode (string) maxLength
            if (this.CallingCode != null && this.CallingCode.Length > 4)
            {
                yield return new ValidationResult("Invalid value for CallingCode, length must be less than 4.", new [] { "CallingCode" });
            }

            // Tld (string) maxLength
            if (this.Tld != null && this.Tld.Length > 3)
            {
                yield return new ValidationResult("Invalid value for Tld, length must be less than 3.", new [] { "Tld" });
            }

            // Language (string) maxLength
            if (this.Language != null && this.Language.Length > 5)
            {
                yield return new ValidationResult("Invalid value for Language, length must be less than 5.", new [] { "Language" });
            }

            // Timezone (string) maxLength
            if (this.Timezone != null && this.Timezone.Length > 45)
            {
                yield return new ValidationResult("Invalid value for Timezone, length must be less than 45.", new [] { "Timezone" });
            }

            // Currency (string) maxLength
            if (this.Currency != null && this.Currency.Length > 3)
            {
                yield return new ValidationResult("Invalid value for Currency, length must be less than 3.", new [] { "Currency" });
            }

            yield break;
        }
    }

}
