/*
 * Warframe.market API
 *
 * ## Documentation is under very slow and heavy development  This document will gradually be supplemented and updated over some extended period of time.  ## Unstable endpoints Endpoint that is not stable and probably will be changed in the future will be marked with exclamation sign -> ⚠ 
 *
 * The version of the OpenAPI document: 1.14.0
 * Generated by: https://github.com/openapitools/openapi-generator.git
 */


using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = WarframeMarket.Client.OpenAPIDateConverter;

namespace WarframeMarket.Model
{
    /// <summary>
    /// AuctionsCreatePostRequest
    /// </summary>
    [DataContract(Name = "_auctions_create_post_request")]
    public partial class AuctionsCreatePostRequest : IEquatable<AuctionsCreatePostRequest>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="AuctionsCreatePostRequest" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected AuctionsCreatePostRequest() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="AuctionsCreatePostRequest" /> class.
        /// </summary>
        /// <param name="note">note.</param>
        /// <param name="startingPrice">startingPrice (required).</param>
        /// <param name="buyoutPrice">If you want ∞ as buyout price, set this to &#x60;null&#x60; (required).</param>
        /// <param name="minimalIncrement">Minimum delta between the bids, Not appliable right now (default to 1).</param>
        /// <param name="minimalReputation">Minimum reputation requirenment for participation in this auction. (default to 0).</param>
        /// <param name="varPrivate">is this auction is private and only accesibly by direct link. (default to false).</param>
        /// <param name="item">item (required).</param>
        public AuctionsCreatePostRequest(string note = default(string), int startingPrice = default(int), int? buyoutPrice = default(int?), int minimalIncrement = 1, int minimalReputation = 0, bool varPrivate = false, AuctionsCreatePostRequestItem item = default(AuctionsCreatePostRequestItem))
        {
            this.StartingPrice = startingPrice;
            // to ensure "buyoutPrice" is required (not null)
            if (buyoutPrice == null)
            {
                throw new ArgumentNullException("buyoutPrice is a required property for AuctionsCreatePostRequest and cannot be null");
            }
            this.BuyoutPrice = buyoutPrice;
            // to ensure "item" is required (not null)
            if (item == null)
            {
                throw new ArgumentNullException("item is a required property for AuctionsCreatePostRequest and cannot be null");
            }
            this.Item = item;
            this.Note = note;
            this.MinimalIncrement = minimalIncrement;
            this.MinimalReputation = minimalReputation;
            this.VarPrivate = varPrivate;
        }

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

        /// <summary>
        /// Gets or Sets StartingPrice
        /// </summary>
        [DataMember(Name = "starting_price", IsRequired = true, EmitDefaultValue = true)]
        public int StartingPrice { get; set; }

        /// <summary>
        /// If you want ∞ as buyout price, set this to &#x60;null&#x60;
        /// </summary>
        /// <value>If you want ∞ as buyout price, set this to &#x60;null&#x60;</value>
        [DataMember(Name = "buyout_price", IsRequired = true, EmitDefaultValue = true)]
        public int? BuyoutPrice { get; set; }

        /// <summary>
        /// Minimum delta between the bids, Not appliable right now
        /// </summary>
        /// <value>Minimum delta between the bids, Not appliable right now</value>
        [DataMember(Name = "minimal_increment", EmitDefaultValue = false)]
        public int MinimalIncrement { get; set; }

        /// <summary>
        /// Minimum reputation requirenment for participation in this auction.
        /// </summary>
        /// <value>Minimum reputation requirenment for participation in this auction.</value>
        [DataMember(Name = "minimal_reputation", EmitDefaultValue = false)]
        public int MinimalReputation { get; set; }

        /// <summary>
        /// is this auction is private and only accesibly by direct link.
        /// </summary>
        /// <value>is this auction is private and only accesibly by direct link.</value>
        [DataMember(Name = "private", EmitDefaultValue = true)]
        public bool VarPrivate { get; set; }

        /// <summary>
        /// Gets or Sets Item
        /// </summary>
        [DataMember(Name = "item", IsRequired = true, EmitDefaultValue = true)]
        public AuctionsCreatePostRequestItem Item { get; set; }

        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("class AuctionsCreatePostRequest {\n");
            sb.Append("  Note: ").Append(Note).Append("\n");
            sb.Append("  StartingPrice: ").Append(StartingPrice).Append("\n");
            sb.Append("  BuyoutPrice: ").Append(BuyoutPrice).Append("\n");
            sb.Append("  MinimalIncrement: ").Append(MinimalIncrement).Append("\n");
            sb.Append("  MinimalReputation: ").Append(MinimalReputation).Append("\n");
            sb.Append("  VarPrivate: ").Append(VarPrivate).Append("\n");
            sb.Append("  Item: ").Append(Item).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 Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.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 AuctionsCreatePostRequest);
        }

        /// <summary>
        /// Returns true if AuctionsCreatePostRequest instances are equal
        /// </summary>
        /// <param name="input">Instance of AuctionsCreatePostRequest to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(AuctionsCreatePostRequest input)
        {
            if (input == null)
            {
                return false;
            }
            return 
                (
                    this.Note == input.Note ||
                    (this.Note != null &&
                    this.Note.Equals(input.Note))
                ) && 
                (
                    this.StartingPrice == input.StartingPrice ||
                    this.StartingPrice.Equals(input.StartingPrice)
                ) && 
                (
                    this.BuyoutPrice == input.BuyoutPrice ||
                    (this.BuyoutPrice != null &&
                    this.BuyoutPrice.Equals(input.BuyoutPrice))
                ) && 
                (
                    this.MinimalIncrement == input.MinimalIncrement ||
                    this.MinimalIncrement.Equals(input.MinimalIncrement)
                ) && 
                (
                    this.MinimalReputation == input.MinimalReputation ||
                    this.MinimalReputation.Equals(input.MinimalReputation)
                ) && 
                (
                    this.VarPrivate == input.VarPrivate ||
                    this.VarPrivate.Equals(input.VarPrivate)
                ) && 
                (
                    this.Item == input.Item ||
                    (this.Item != null &&
                    this.Item.Equals(input.Item))
                );
        }

        /// <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.Note != null)
                {
                    hashCode = (hashCode * 59) + this.Note.GetHashCode();
                }
                hashCode = (hashCode * 59) + this.StartingPrice.GetHashCode();
                if (this.BuyoutPrice != null)
                {
                    hashCode = (hashCode * 59) + this.BuyoutPrice.GetHashCode();
                }
                hashCode = (hashCode * 59) + this.MinimalIncrement.GetHashCode();
                hashCode = (hashCode * 59) + this.MinimalReputation.GetHashCode();
                hashCode = (hashCode * 59) + this.VarPrivate.GetHashCode();
                if (this.Item != null)
                {
                    hashCode = (hashCode * 59) + this.Item.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)
        {
            // Note (string) maxLength
            if (this.Note != null && this.Note.Length > 200)
            {
                yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Note, length must be less than 200.", new [] { "Note" });
            }

            // Note (string) minLength
            if (this.Note != null && this.Note.Length < 0)
            {
                yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Note, length must be greater than 0.", new [] { "Note" });
            }

            // StartingPrice (int) maximum
            if (this.StartingPrice > (int)900000)
            {
                yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for StartingPrice, must be a value less than or equal to 900000.", new [] { "StartingPrice" });
            }

            // StartingPrice (int) minimum
            if (this.StartingPrice < (int)1)
            {
                yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for StartingPrice, must be a value greater than or equal to 1.", new [] { "StartingPrice" });
            }

            // BuyoutPrice (int?) maximum
            if (this.BuyoutPrice > (int?)900000)
            {
                yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for BuyoutPrice, must be a value less than or equal to 900000.", new [] { "BuyoutPrice" });
            }

            // BuyoutPrice (int?) minimum
            if (this.BuyoutPrice < (int?)1)
            {
                yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for BuyoutPrice, must be a value greater than or equal to 1.", new [] { "BuyoutPrice" });
            }

            // MinimalIncrement (int) maximum
            if (this.MinimalIncrement > (int)900000)
            {
                yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinimalIncrement, must be a value less than or equal to 900000.", new [] { "MinimalIncrement" });
            }

            // MinimalIncrement (int) minimum
            if (this.MinimalIncrement < (int)1)
            {
                yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinimalIncrement, must be a value greater than or equal to 1.", new [] { "MinimalIncrement" });
            }

            // MinimalReputation (int) maximum
            if (this.MinimalReputation > (int)1000)
            {
                yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinimalReputation, must be a value less than or equal to 1000.", new [] { "MinimalReputation" });
            }

            // MinimalReputation (int) minimum
            if (this.MinimalReputation < (int)1)
            {
                yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinimalReputation, must be a value greater than or equal to 1.", new [] { "MinimalReputation" });
            }

            yield break;
        }
    }

}
