/* 
 * Forge SDK
 *
 * The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering.
 *
 * OpenAPI spec version: 0.1.0
 * Contact: forge.help@autodesk.com
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace Autodesk.Forge.Model
{
    /// <summary>
    /// RelRefMeta
    /// </summary>
    [DataContract]
    public partial class RelRefMeta :  IEquatable<RelRefMeta>
    {
        /// <summary>
        /// Gets or Sets RefType
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public enum RefTypeEnum
        {
            
            /// <summary>
            /// Enum Derived for "derived"
            /// </summary>
            [EnumMember(Value = "derived")]
            Derived,
            
            /// <summary>
            /// Enum Dependencies for "dependencies"
            /// </summary>
            [EnumMember(Value = "dependencies")]
            Dependencies,
            
            /// <summary>
            /// Enum Auxiliary for "auxiliary"
            /// </summary>
            [EnumMember(Value = "auxiliary")]
            Auxiliary,
            
            /// <summary>
            /// Enum Xrefs for "xrefs"
            /// </summary>
            [EnumMember(Value = "xrefs")]
            Xrefs
        }

        /// <summary>
        /// describes the direction of the reference relative to the resource the refs are queried for
        /// </summary>
        /// <value>describes the direction of the reference relative to the resource the refs are queried for</value>
        [JsonConverter(typeof(StringEnumConverter))]
        public enum DirectionEnum
        {
            
            /// <summary>
            /// Enum From for "from"
            /// </summary>
            [EnumMember(Value = "from")]
            From,
            
            /// <summary>
            /// Enum To for "to"
            /// </summary>
            [EnumMember(Value = "to")]
            To
        }

        /// <summary>
        /// Gets or Sets FromType
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public enum FromTypeEnum
        {
            
            /// <summary>
            /// Enum Folders for "folders"
            /// </summary>
            [EnumMember(Value = "folders")]
            Folders,
            
            /// <summary>
            /// Enum Items for "items"
            /// </summary>
            [EnumMember(Value = "items")]
            Items,
            
            /// <summary>
            /// Enum Versions for "versions"
            /// </summary>
            [EnumMember(Value = "versions")]
            Versions
        }

        /// <summary>
        /// Gets or Sets ToType
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public enum ToTypeEnum
        {
            
            /// <summary>
            /// Enum Folders for "folders"
            /// </summary>
            [EnumMember(Value = "folders")]
            Folders,
            
            /// <summary>
            /// Enum Items for "items"
            /// </summary>
            [EnumMember(Value = "items")]
            Items,
            
            /// <summary>
            /// Enum Versions for "versions"
            /// </summary>
            [EnumMember(Value = "versions")]
            Versions
        }

        /// <summary>
        /// Gets or Sets RefType
        /// </summary>
        [DataMember(Name="refType", EmitDefaultValue=false)]
        public RefTypeEnum? RefType { get; set; }
        /// <summary>
        /// describes the direction of the reference relative to the resource the refs are queried for
        /// </summary>
        /// <value>describes the direction of the reference relative to the resource the refs are queried for</value>
        [DataMember(Name="direction", EmitDefaultValue=false)]
        public DirectionEnum? Direction { get; set; }
        /// <summary>
        /// Gets or Sets FromType
        /// </summary>
        [DataMember(Name="fromType", EmitDefaultValue=false)]
        public FromTypeEnum? FromType { get; set; }
        /// <summary>
        /// Gets or Sets ToType
        /// </summary>
        [DataMember(Name="toType", EmitDefaultValue=false)]
        public ToTypeEnum? ToType { get; set; }
        /// <summary>
        /// Initializes a new instance of the <see cref="RelRefMeta" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected RelRefMeta() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="RelRefMeta" /> class.
        /// </summary>
        /// <param name="RefType">RefType (required).</param>
        /// <param name="Direction">describes the direction of the reference relative to the resource the refs are queried for (required).</param>
        /// <param name="FromId">FromId (required).</param>
        /// <param name="FromType">FromType (required).</param>
        /// <param name="ToId">ToId (required).</param>
        /// <param name="ToType">ToType (required).</param>
        /// <param name="Extension">Extension (required).</param>
        public RelRefMeta(RefTypeEnum? RefType = null, DirectionEnum? Direction = null, string FromId = null, FromTypeEnum? FromType = null, string ToId = null, ToTypeEnum? ToType = null, BaseAttributesExtensionObject Extension = null)
        {
            // to ensure "RefType" is required (not null)
            if (RefType == null)
            {
                throw new InvalidDataException("RefType is a required property for RelRefMeta and cannot be null");
            }
            else
            {
                this.RefType = RefType;
            }
            // to ensure "Direction" is required (not null)
            if (Direction == null)
            {
                throw new InvalidDataException("Direction is a required property for RelRefMeta and cannot be null");
            }
            else
            {
                this.Direction = Direction;
            }
            // to ensure "FromId" is required (not null)
            if (FromId == null)
            {
                throw new InvalidDataException("FromId is a required property for RelRefMeta and cannot be null");
            }
            else
            {
                this.FromId = FromId;
            }
            // to ensure "FromType" is required (not null)
            if (FromType == null)
            {
                throw new InvalidDataException("FromType is a required property for RelRefMeta and cannot be null");
            }
            else
            {
                this.FromType = FromType;
            }
            // to ensure "ToId" is required (not null)
            if (ToId == null)
            {
                throw new InvalidDataException("ToId is a required property for RelRefMeta and cannot be null");
            }
            else
            {
                this.ToId = ToId;
            }
            // to ensure "ToType" is required (not null)
            if (ToType == null)
            {
                throw new InvalidDataException("ToType is a required property for RelRefMeta and cannot be null");
            }
            else
            {
                this.ToType = ToType;
            }
            // to ensure "Extension" is required (not null)
            if (Extension == null)
            {
                throw new InvalidDataException("Extension is a required property for RelRefMeta and cannot be null");
            }
            else
            {
                this.Extension = Extension;
            }
        }
        
        /// <summary>
        /// Gets or Sets FromId
        /// </summary>
        [DataMember(Name="fromId", EmitDefaultValue=false)]
        public string FromId { get; set; }
        /// <summary>
        /// Gets or Sets ToId
        /// </summary>
        [DataMember(Name="toId", EmitDefaultValue=false)]
        public string ToId { get; set; }
        /// <summary>
        /// Gets or Sets Extension
        /// </summary>
        [DataMember(Name="extension", EmitDefaultValue=false)]
        public BaseAttributesExtensionObject Extension { 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 RelRefMeta {\n");
            sb.Append("  RefType: ").Append(RefType).Append("\n");
            sb.Append("  Direction: ").Append(Direction).Append("\n");
            sb.Append("  FromId: ").Append(FromId).Append("\n");
            sb.Append("  FromType: ").Append(FromType).Append("\n");
            sb.Append("  ToId: ").Append(ToId).Append("\n");
            sb.Append("  ToType: ").Append(ToType).Append("\n");
            sb.Append("  Extension: ").Append(Extension).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 string ToJson()
        {
            return JsonConvert.SerializeObject(this, Formatting.Indented);
        }

        /// <summary>
        /// Returns true if objects are equal
        /// </summary>
        /// <param name="obj">Object to be compared</param>
        /// <returns>Boolean</returns>
        public override bool Equals(object obj)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            return this.Equals(obj as RelRefMeta);
        }

        /// <summary>
        /// Returns true if RelRefMeta instances are equal
        /// </summary>
        /// <param name="other">Instance of RelRefMeta to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(RelRefMeta other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
                return false;

            return 
                (
                    this.RefType == other.RefType ||
                    this.RefType != null &&
                    this.RefType.Equals(other.RefType)
                ) && 
                (
                    this.Direction == other.Direction ||
                    this.Direction != null &&
                    this.Direction.Equals(other.Direction)
                ) && 
                (
                    this.FromId == other.FromId ||
                    this.FromId != null &&
                    this.FromId.Equals(other.FromId)
                ) && 
                (
                    this.FromType == other.FromType ||
                    this.FromType != null &&
                    this.FromType.Equals(other.FromType)
                ) && 
                (
                    this.ToId == other.ToId ||
                    this.ToId != null &&
                    this.ToId.Equals(other.ToId)
                ) && 
                (
                    this.ToType == other.ToType ||
                    this.ToType != null &&
                    this.ToType.Equals(other.ToType)
                ) && 
                (
                    this.Extension == other.Extension ||
                    this.Extension != null &&
                    this.Extension.Equals(other.Extension)
                );
        }

        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                int hash = 41;
                // Suitable nullity checks etc, of course :)
                if (this.RefType != null)
                    hash = hash * 59 + this.RefType.GetHashCode();
                if (this.Direction != null)
                    hash = hash * 59 + this.Direction.GetHashCode();
                if (this.FromId != null)
                    hash = hash * 59 + this.FromId.GetHashCode();
                if (this.FromType != null)
                    hash = hash * 59 + this.FromType.GetHashCode();
                if (this.ToId != null)
                    hash = hash * 59 + this.ToId.GetHashCode();
                if (this.ToType != null)
                    hash = hash * 59 + this.ToType.GetHashCode();
                if (this.Extension != null)
                    hash = hash * 59 + this.Extension.GetHashCode();
                return hash;
            }
        }
    }

}

