/* 
 * bSDD API prototype
 *
 * API to access the buildingSMART Data Dictionary
 *
 * OpenAPI spec version: v1
 * Contact: bsdd_support@buildingsmart.org
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 */
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;

namespace IO.Swagger.Model
{
    /// <summary>
    /// SearchResultContractV2
    /// </summary>
    [DataContract]
        public partial class SearchResultContractV2 :  IEquatable<SearchResultContractV2>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="SearchResultContractV2" /> class.
        /// </summary>
        /// <param name="numberOfClassificationsFound">The total number of Classifications matching the search criteria.</param>
        /// <param name="domains">The list of Domains with found Classification and ClassificationProperties.</param>
        public SearchResultContractV2(int? numberOfClassificationsFound = default(int?), List<DomainSearchResultContractV2> domains = default(List<DomainSearchResultContractV2>))
        {
            this.NumberOfClassificationsFound = numberOfClassificationsFound;
            this.Domains = domains;
        }
        
        /// <summary>
        /// The total number of Classifications matching the search criteria
        /// </summary>
        /// <value>The total number of Classifications matching the search criteria</value>
        [DataMember(Name="numberOfClassificationsFound", EmitDefaultValue=false)]
        public int? NumberOfClassificationsFound { get; set; }

        /// <summary>
        /// The list of Domains with found Classification and ClassificationProperties
        /// </summary>
        /// <value>The list of Domains with found Classification and ClassificationProperties</value>
        [DataMember(Name="domains", EmitDefaultValue=false)]
        public List<DomainSearchResultContractV2> Domains { get; set; }

        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            var sb = new StringBuilder();
            sb.Append("class SearchResultContractV2 {\n");
            sb.Append("  NumberOfClassificationsFound: ").Append(NumberOfClassificationsFound).Append("\n");
            sb.Append("  Domains: ").Append(Domains).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 JsonConvert.SerializeObject(this, Formatting.Indented);
        }

        /// <summary>
        /// Returns true if objects are equal
        /// </summary>
        /// <param name="input">Object to be compared</param>
        /// <returns>Boolean</returns>
        public override bool Equals(object input)
        {
            return this.Equals(input as SearchResultContractV2);
        }

        /// <summary>
        /// Returns true if SearchResultContractV2 instances are equal
        /// </summary>
        /// <param name="input">Instance of SearchResultContractV2 to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(SearchResultContractV2 input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.NumberOfClassificationsFound == input.NumberOfClassificationsFound ||
                    (this.NumberOfClassificationsFound != null &&
                    this.NumberOfClassificationsFound.Equals(input.NumberOfClassificationsFound))
                ) && 
                (
                    this.Domains == input.Domains ||
                    this.Domains != null &&
                    input.Domains != null &&
                    this.Domains.SequenceEqual(input.Domains)
                );
        }

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

        /// <summary>
        /// To validate all properties of the instance
        /// </summary>
        /// <param name="validationContext">Validation context</param>
        /// <returns>Validation Result</returns>
        IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            yield break;
        }
    }
}
