/* 
 * 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>
    /// ClassificationRelationContractV3
    /// </summary>
    [DataContract]
        public partial class ClassificationRelationContractV3 :  IEquatable<ClassificationRelationContractV3>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ClassificationRelationContractV3" /> class.
        /// </summary>
        /// <param name="relationType">Can be one of: HasReference, IsEqualTo, IsSynonymOf, IsParentOf, IsChildOf, HasPart (required).</param>
        /// <param name="relatedClassificationUri">Namespace URI of the related classification (required).</param>
        /// <param name="relatedClassificationName">Name of the related classification.</param>
        public ClassificationRelationContractV3(string relationType = default(string), string relatedClassificationUri = default(string), string relatedClassificationName = default(string))
        {
            // to ensure "relationType" is required (not null)
            if (relationType == null)
            {
                throw new InvalidDataException("relationType is a required property for ClassificationRelationContractV3 and cannot be null");
            }
            else
            {
                this.RelationType = relationType;
            }
            // to ensure "relatedClassificationUri" is required (not null)
            if (relatedClassificationUri == null)
            {
                throw new InvalidDataException("relatedClassificationUri is a required property for ClassificationRelationContractV3 and cannot be null");
            }
            else
            {
                this.RelatedClassificationUri = relatedClassificationUri;
            }
            this.RelatedClassificationName = relatedClassificationName;
        }
        
        /// <summary>
        /// Can be one of: HasReference, IsEqualTo, IsSynonymOf, IsParentOf, IsChildOf, HasPart
        /// </summary>
        /// <value>Can be one of: HasReference, IsEqualTo, IsSynonymOf, IsParentOf, IsChildOf, HasPart</value>
        [DataMember(Name="relationType", EmitDefaultValue=false)]
        public string RelationType { get; set; }

        /// <summary>
        /// Namespace URI of the related classification
        /// </summary>
        /// <value>Namespace URI of the related classification</value>
        [DataMember(Name="relatedClassificationUri", EmitDefaultValue=false)]
        public string RelatedClassificationUri { get; set; }

        /// <summary>
        /// Name of the related classification
        /// </summary>
        /// <value>Name of the related classification</value>
        [DataMember(Name="relatedClassificationName", EmitDefaultValue=false)]
        public string RelatedClassificationName { 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 ClassificationRelationContractV3 {\n");
            sb.Append("  RelationType: ").Append(RelationType).Append("\n");
            sb.Append("  RelatedClassificationUri: ").Append(RelatedClassificationUri).Append("\n");
            sb.Append("  RelatedClassificationName: ").Append(RelatedClassificationName).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 ClassificationRelationContractV3);
        }

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

            return 
                (
                    this.RelationType == input.RelationType ||
                    (this.RelationType != null &&
                    this.RelationType.Equals(input.RelationType))
                ) && 
                (
                    this.RelatedClassificationUri == input.RelatedClassificationUri ||
                    (this.RelatedClassificationUri != null &&
                    this.RelatedClassificationUri.Equals(input.RelatedClassificationUri))
                ) && 
                (
                    this.RelatedClassificationName == input.RelatedClassificationName ||
                    (this.RelatedClassificationName != null &&
                    this.RelatedClassificationName.Equals(input.RelatedClassificationName))
                );
        }

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