/* 
 * GK application - OmniPOS Service API
 *
 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version: 5.21.1-b03
 * 
 * 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>
    /// UomConversionSO &lt;p&gt;Conversion of one measure unit into another one.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Not used. Not filled in the data editor.&lt;br /&gt;&lt;/p&gt;
    /// </summary>
    [DataContract]
    public partial class ComGkSoftwareSweeSesApiServerMdUomDtoSoUomConversionSO :  IEquatable<ComGkSoftwareSweeSesApiServerMdUomDtoSoUomConversionSO>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ComGkSoftwareSweeSesApiServerMdUomDtoSoUomConversionSO" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected ComGkSoftwareSweeSesApiServerMdUomDtoSoUomConversionSO() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="ComGkSoftwareSweeSesApiServerMdUomDtoSoUomConversionSO" /> class.
        /// </summary>
        /// <param name="sourceUomCode">&lt;p&gt;Source unit of measure code&lt;br /&gt;&lt;/p&gt; (required).</param>
        /// <param name="destinationUomCode">&lt;p&gt;Destination unit of measure code&lt;br /&gt;&lt;/p&gt;.</param>
        /// <param name="factor">&lt;p&gt;The factor that converts the source UOM to the destination UOM&lt;br /&gt;&lt;/p&gt;.</param>
        /// <param name="multiplyFlag">&lt;p&gt;Determines whether conversion is done by multiplying (true) or dividing (false)&lt;br /&gt;&lt;/p&gt;.</param>
        public ComGkSoftwareSweeSesApiServerMdUomDtoSoUomConversionSO(string sourceUomCode = default(string), string destinationUomCode = default(string), double? factor = default(double?), bool? multiplyFlag = default(bool?))
        {
            // to ensure "sourceUomCode" is required (not null)
            if (sourceUomCode == null)
            {
                throw new InvalidDataException("sourceUomCode is a required property for ComGkSoftwareSweeSesApiServerMdUomDtoSoUomConversionSO and cannot be null");
            }
            else
            {
                this.SourceUomCode = sourceUomCode;
            }
            this.DestinationUomCode = destinationUomCode;
            this.Factor = factor;
            this.MultiplyFlag = multiplyFlag;
        }
        
        /// <summary>
        /// &lt;p&gt;Source unit of measure code&lt;br /&gt;&lt;/p&gt;
        /// </summary>
        /// <value>&lt;p&gt;Source unit of measure code&lt;br /&gt;&lt;/p&gt;</value>
        [DataMember(Name="sourceUomCode", EmitDefaultValue=false)]
        public string SourceUomCode { get; set; }

        /// <summary>
        /// &lt;p&gt;Destination unit of measure code&lt;br /&gt;&lt;/p&gt;
        /// </summary>
        /// <value>&lt;p&gt;Destination unit of measure code&lt;br /&gt;&lt;/p&gt;</value>
        [DataMember(Name="destinationUomCode", EmitDefaultValue=false)]
        public string DestinationUomCode { get; set; }

        /// <summary>
        /// &lt;p&gt;The factor that converts the source UOM to the destination UOM&lt;br /&gt;&lt;/p&gt;
        /// </summary>
        /// <value>&lt;p&gt;The factor that converts the source UOM to the destination UOM&lt;br /&gt;&lt;/p&gt;</value>
        [DataMember(Name="factor", EmitDefaultValue=false)]
        public double? Factor { get; set; }

        /// <summary>
        /// &lt;p&gt;Determines whether conversion is done by multiplying (true) or dividing (false)&lt;br /&gt;&lt;/p&gt;
        /// </summary>
        /// <value>&lt;p&gt;Determines whether conversion is done by multiplying (true) or dividing (false)&lt;br /&gt;&lt;/p&gt;</value>
        [DataMember(Name="multiplyFlag", EmitDefaultValue=false)]
        public bool? MultiplyFlag { 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 ComGkSoftwareSweeSesApiServerMdUomDtoSoUomConversionSO {\n");
            sb.Append("  SourceUomCode: ").Append(SourceUomCode).Append("\n");
            sb.Append("  DestinationUomCode: ").Append(DestinationUomCode).Append("\n");
            sb.Append("  Factor: ").Append(Factor).Append("\n");
            sb.Append("  MultiplyFlag: ").Append(MultiplyFlag).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 ComGkSoftwareSweeSesApiServerMdUomDtoSoUomConversionSO);
        }

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

            return 
                (
                    this.SourceUomCode == input.SourceUomCode ||
                    (this.SourceUomCode != null &&
                    this.SourceUomCode.Equals(input.SourceUomCode))
                ) && 
                (
                    this.DestinationUomCode == input.DestinationUomCode ||
                    (this.DestinationUomCode != null &&
                    this.DestinationUomCode.Equals(input.DestinationUomCode))
                ) && 
                (
                    this.Factor == input.Factor ||
                    (this.Factor != null &&
                    this.Factor.Equals(input.Factor))
                ) && 
                (
                    this.MultiplyFlag == input.MultiplyFlag ||
                    (this.MultiplyFlag != null &&
                    this.MultiplyFlag.Equals(input.MultiplyFlag))
                );
        }

        /// <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.SourceUomCode != null)
                    hashCode = hashCode * 59 + this.SourceUomCode.GetHashCode();
                if (this.DestinationUomCode != null)
                    hashCode = hashCode * 59 + this.DestinationUomCode.GetHashCode();
                if (this.Factor != null)
                    hashCode = hashCode * 59 + this.Factor.GetHashCode();
                if (this.MultiplyFlag != null)
                    hashCode = hashCode * 59 + this.MultiplyFlag.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;
        }
    }

}
