/* 
 * 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>
    /// ClassificationReferenceContractV3
    /// </summary>
    [DataContract]
        public partial class ClassificationReferenceContractV3 :  IEquatable<ClassificationReferenceContractV3>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ClassificationReferenceContractV3" /> class.
        /// </summary>
        /// <param name="namespaceUri">namespaceUri (required).</param>
        /// <param name="name">name.</param>
        /// <param name="code">code.</param>
        public ClassificationReferenceContractV3(string namespaceUri = default(string), string name = default(string), string code = default(string))
        {
            // to ensure "namespaceUri" is required (not null)
            if (namespaceUri == null)
            {
                throw new InvalidDataException("namespaceUri is a required property for ClassificationReferenceContractV3 and cannot be null");
            }
            else
            {
                this.NamespaceUri = namespaceUri;
            }
            this.Name = name;
            this.Code = code;
        }
        
        /// <summary>
        /// Gets or Sets NamespaceUri
        /// </summary>
        [DataMember(Name="namespaceUri", EmitDefaultValue=false)]
        public string NamespaceUri { get; set; }

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

        /// <summary>
        /// Gets or Sets Code
        /// </summary>
        [DataMember(Name="code", EmitDefaultValue=false)]
        public string Code { 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 ClassificationReferenceContractV3 {\n");
            sb.Append("  NamespaceUri: ").Append(NamespaceUri).Append("\n");
            sb.Append("  Name: ").Append(Name).Append("\n");
            sb.Append("  Code: ").Append(Code).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 ClassificationReferenceContractV3);
        }

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

            return 
                (
                    this.NamespaceUri == input.NamespaceUri ||
                    (this.NamespaceUri != null &&
                    this.NamespaceUri.Equals(input.NamespaceUri))
                ) && 
                (
                    this.Name == input.Name ||
                    (this.Name != null &&
                    this.Name.Equals(input.Name))
                ) && 
                (
                    this.Code == input.Code ||
                    (this.Code != null &&
                    this.Code.Equals(input.Code))
                );
        }

        /// <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.NamespaceUri != null)
                    hashCode = hashCode * 59 + this.NamespaceUri.GetHashCode();
                if (this.Name != null)
                    hashCode = hashCode * 59 + this.Name.GetHashCode();
                if (this.Code != null)
                    hashCode = hashCode * 59 + this.Code.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;
        }
    }
}
