/* 
 * 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>
    /// PropertyValueContractV1
    /// </summary>
    [DataContract]
        public partial class PropertyValueContractV1 :  IEquatable<PropertyValueContractV1>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyValueContractV1" /> class.
        /// </summary>
        /// <param name="namespaceUri">Globally unique identification of the value (if present).</param>
        /// <param name="code">Identification of the value (unique within the property).</param>
        /// <param name="value">Possible value of the property (required).</param>
        /// <param name="description">Description of the value.</param>
        /// <param name="sortNumber">(Optional) Sort number of value within the list of values for the Property.</param>
        public PropertyValueContractV1(string namespaceUri = default(string), string code = default(string), string value = default(string), string description = default(string), int? sortNumber = default(int?))
        {
            // to ensure "value" is required (not null)
            if (value == null)
            {
                throw new InvalidDataException("value is a required property for PropertyValueContractV1 and cannot be null");
            }
            else
            {
                this.Value = value;
            }
            this.NamespaceUri = namespaceUri;
            this.Code = code;
            this.Description = description;
            this.SortNumber = sortNumber;
        }
        
        /// <summary>
        /// Globally unique identification of the value (if present)
        /// </summary>
        /// <value>Globally unique identification of the value (if present)</value>
        [DataMember(Name="namespaceUri", EmitDefaultValue=false)]
        public string NamespaceUri { get; set; }

        /// <summary>
        /// Identification of the value (unique within the property)
        /// </summary>
        /// <value>Identification of the value (unique within the property)</value>
        [DataMember(Name="code", EmitDefaultValue=false)]
        public string Code { get; set; }

        /// <summary>
        /// Possible value of the property
        /// </summary>
        /// <value>Possible value of the property</value>
        [DataMember(Name="value", EmitDefaultValue=false)]
        public string Value { get; set; }

        /// <summary>
        /// Description of the value
        /// </summary>
        /// <value>Description of the value</value>
        [DataMember(Name="description", EmitDefaultValue=false)]
        public string Description { get; set; }

        /// <summary>
        /// (Optional) Sort number of value within the list of values for the Property
        /// </summary>
        /// <value>(Optional) Sort number of value within the list of values for the Property</value>
        [DataMember(Name="sortNumber", EmitDefaultValue=false)]
        public int? SortNumber { 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 PropertyValueContractV1 {\n");
            sb.Append("  NamespaceUri: ").Append(NamespaceUri).Append("\n");
            sb.Append("  Code: ").Append(Code).Append("\n");
            sb.Append("  Value: ").Append(Value).Append("\n");
            sb.Append("  Description: ").Append(Description).Append("\n");
            sb.Append("  SortNumber: ").Append(SortNumber).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 PropertyValueContractV1);
        }

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

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

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