/*
* FHT.Core.API 1.0
*
* ̨group.apiVersion:1.0
*
* OpenAPI spec version: v1
* Contact: fht@fht360.com
* 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;
namespace IO.Swagger.Model
{
#pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null'
///
/// TestSwaggerInputModel
///
[DataContract]
public partial class TestSwaggerInputModel : TestSwaggerSimpleInputModel, IEquatable, IValidatableObject //Mark 555
{
///
/// FHT.Core.CommonTypes.Gender, FHT.Core.CommonTypes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
///
/// FHT.Core.CommonTypes.Gender, FHT.Core.CommonTypes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[DataMember(Name="Genders", EmitDefaultValue=false)]
public GenderEnum Genders { get; set; }
///
/// FHT.Core.CommonTypes.Gender, FHT.Core.CommonTypes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
///
/// FHT.Core.CommonTypes.Gender, FHT.Core.CommonTypes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[DataMember(Name="Gender", EmitDefaultValue=false)]
public GenderEnum? Gender { get; set; }
///
/// FHT.Core.CommonTypes.Gender, FHT.Core.CommonTypes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
///
/// FHT.Core.CommonTypes.Gender, FHT.Core.CommonTypes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[DataMember(Name="NullableGender", EmitDefaultValue=false)]
public GenderEnum? NullableGender { get; set; }
///
/// 2. Initializes a new instance of the class.
///
[JsonConstructorAttribute]
protected TestSwaggerInputModel() { }
///
/// Not Enum: Gets or Sets Child
///
[DataMember(Name="Child", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {}
public TestSwaggerInputModel Child { get; set; }
///
/// Not Enum: Gets or Sets RequiredChild
///
[DataMember(Name="RequiredChild", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-required=必须输入}
public TestSwaggerInputModel RequiredChild { get; set; }
///
/// Not Enum: Gets or Sets Children
///
[DataMember(Name="Children", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {}
public List Children { get; set; }
///
/// Not Enum: Gets or Sets RequiredChildren
///
[DataMember(Name="RequiredChildren", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-required=必须输入}
public List RequiredChildren { get; set; }
///
/// Not Enum: Gets or Sets RequiredInt
///
[DataMember(Name="RequiredInt", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-required=必须输入RequiredInt, x-range=RequiredInt必须不小于1, x-range-min=1, x-display-name=RequiredInt, x-isnullable=false}
public int? RequiredInt { get; set; }
///
/// Not Enum: Gets or Sets NonRequiredInt
///
[DataMember(Name="NonRequiredInt", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-range=必须不小于1, x-range-min=1, x-isnullable=false}
public int? NonRequiredInt { get; set; }
///
/// Not Enum: Gets or Sets NullableInt
///
[DataMember(Name="NullableInt", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-range=必须不小于1, x-range-min=1, x-isnullable=true}
public int? NullableInt { get; set; }
///
/// Not Enum: Gets or Sets RequiredString
///
[DataMember(Name="RequiredString", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-required=请输入公司名称, x-string-length=公司名称必须是2到20位, x-string-length-min=2, x-string-length-max=20, x-display-name=公司名称, x-regex=^[A-Za-z0-9\\u4E00-\\u9FA5][A-Za-z0-9\\(\\)\\(\\)\\u4E00-\\u9FA5]{1,19}$, x-regex-regex=^[A-Za-z0-9\u4E00-\u9FA5][A-Za-z0-9\(\)\(\)\u4E00-\u9FA5]{1,19}$, x-modifiers=[CultureInvariant]}
public string RequiredString { get; set; }
///
/// Not Enum: Gets or Sets NonRequiredString
///
[DataMember(Name="NonRequiredString", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-string-length=非必须字符串必须是2到20位, x-string-length-min=2, x-string-length-max=20, x-display-name=非必须字符串}
public string NonRequiredString { get; set; }
///
/// Returns the string presentation of the object
///
/// String presentation of the object
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class TestSwaggerInputModel {\n");
sb.Append(" Genders: ").Append(Genders).Append("\n");
sb.Append(" Child: ").Append(Child).Append("\n");
sb.Append(" RequiredChild: ").Append(RequiredChild).Append("\n");
sb.Append(" Children: ").Append(Children).Append("\n");
sb.Append(" RequiredChildren: ").Append(RequiredChildren).Append("\n");
sb.Append(" RequiredInt: ").Append(RequiredInt).Append("\n");
sb.Append(" NonRequiredInt: ").Append(NonRequiredInt).Append("\n");
sb.Append(" NullableInt: ").Append(NullableInt).Append("\n");
sb.Append(" RequiredString: ").Append(RequiredString).Append("\n");
sb.Append(" NonRequiredString: ").Append(NonRequiredString).Append("\n");
sb.Append(" Gender: ").Append(Gender).Append("\n");
sb.Append(" NullableGender: ").Append(NullableGender).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
///
/// Returns the JSON string presentation of the object
///
/// JSON string presentation of the object
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
///
/// Returns true if objects are equal
///
/// Object to be compared
/// Boolean
public override bool Equals(object obj)
{
// credit: http://stackoverflow.com/a/10454552/677735
return this.Equals(obj as TestSwaggerInputModel);
}
///
/// Returns true if TestSwaggerInputModel instances are equal
///
/// Instance of TestSwaggerInputModel to be compared
/// Boolean
public bool Equals(TestSwaggerInputModel other)
{
// credit: http://stackoverflow.com/a/10454552/677735
if (other == null)
return false;
return
(
this.Genders == other.Genders ||
this.Genders != null &&
this.Genders.SequenceEqual(other.Genders)
) &&
(
this.Child == other.Child ||
this.Child != null &&
this.Child.Equals(other.Child)
) &&
(
this.RequiredChild == other.RequiredChild ||
this.RequiredChild != null &&
this.RequiredChild.Equals(other.RequiredChild)
) &&
(
this.Children == other.Children ||
this.Children != null &&
this.Children.SequenceEqual(other.Children)
) &&
(
this.RequiredChildren == other.RequiredChildren ||
this.RequiredChildren != null &&
this.RequiredChildren.SequenceEqual(other.RequiredChildren)
) &&
(
this.RequiredInt == other.RequiredInt ||
this.RequiredInt != null &&
this.RequiredInt.Equals(other.RequiredInt)
) &&
(
this.NonRequiredInt == other.NonRequiredInt ||
this.NonRequiredInt != null &&
this.NonRequiredInt.Equals(other.NonRequiredInt)
) &&
(
this.NullableInt == other.NullableInt ||
this.NullableInt != null &&
this.NullableInt.Equals(other.NullableInt)
) &&
(
this.RequiredString == other.RequiredString ||
this.RequiredString != null &&
this.RequiredString.Equals(other.RequiredString)
) &&
(
this.NonRequiredString == other.NonRequiredString ||
this.NonRequiredString != null &&
this.NonRequiredString.Equals(other.NonRequiredString)
) &&
(
this.Gender == other.Gender ||
this.Gender != null &&
this.Gender.Equals(other.Gender)
) &&
(
this.NullableGender == other.NullableGender ||
this.NullableGender != null &&
this.NullableGender.Equals(other.NullableGender)
);
}
///
/// Gets the hash code
///
/// Hash code
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.Genders != null)
hash = hash * 59 + this.Genders.GetHashCode();
if (this.Child != null)
hash = hash * 59 + this.Child.GetHashCode();
if (this.RequiredChild != null)
hash = hash * 59 + this.RequiredChild.GetHashCode();
if (this.Children != null)
hash = hash * 59 + this.Children.GetHashCode();
if (this.RequiredChildren != null)
hash = hash * 59 + this.RequiredChildren.GetHashCode();
if (this.RequiredInt != null)
hash = hash * 59 + this.RequiredInt.GetHashCode();
if (this.NonRequiredInt != null)
hash = hash * 59 + this.NonRequiredInt.GetHashCode();
if (this.NullableInt != null)
hash = hash * 59 + this.NullableInt.GetHashCode();
if (this.RequiredString != null)
hash = hash * 59 + this.RequiredString.GetHashCode();
if (this.NonRequiredString != null)
hash = hash * 59 + this.NonRequiredString.GetHashCode();
if (this.Gender != null)
hash = hash * 59 + this.Gender.GetHashCode();
if (this.NullableGender != null)
hash = hash * 59 + this.NullableGender.GetHashCode();
return hash;
}
}
public IEnumerable Validate(ValidationContext validationContext)
{
// RequiredInt (int?) maximum
if(this.RequiredInt > (int?)2147483647)
{
yield return new ValidationResult("Invalid value for RequiredInt, must be a value less than or equal to 2147483647.", new [] { "RequiredInt" });
}
// RequiredInt (int?) minimum
if(this.RequiredInt < (int?)1)
{
yield return new ValidationResult("Invalid value for RequiredInt, must be a value greater than or equal to 1.", new [] { "RequiredInt" });
}
// NonRequiredInt (int?) maximum
if(this.NonRequiredInt > (int?)2147483647)
{
yield return new ValidationResult("Invalid value for NonRequiredInt, must be a value less than or equal to 2147483647.", new [] { "NonRequiredInt" });
}
// NonRequiredInt (int?) minimum
if(this.NonRequiredInt < (int?)1)
{
yield return new ValidationResult("Invalid value for NonRequiredInt, must be a value greater than or equal to 1.", new [] { "NonRequiredInt" });
}
// NullableInt (int?) maximum
if(this.NullableInt > (int?)2147483647)
{
yield return new ValidationResult("Invalid value for NullableInt, must be a value less than or equal to 2147483647.", new [] { "NullableInt" });
}
// NullableInt (int?) minimum
if(this.NullableInt < (int?)1)
{
yield return new ValidationResult("Invalid value for NullableInt, must be a value greater than or equal to 1.", new [] { "NullableInt" });
}
// RequiredString (string) maxLength
if(this.RequiredString != null && this.RequiredString.Length > 20)
{
yield return new ValidationResult("Invalid value for RequiredString, length must be less than 20.", new [] { "RequiredString" });
}
// RequiredString (string) minLength
if(this.RequiredString != null && this.RequiredString.Length < 2)
{
yield return new ValidationResult("Invalid value for RequiredString, length must be greater than 2.", new [] { "RequiredString" });
}
// RequiredString (string) pattern
Regex regexRequiredString = new Regex(@"^[A-Za-z0-9\\u4E00-\\u9FA5][A-Za-z0-9\\(\\)\\(\\)\\u4E00-\\u9FA5]{1,19}$", RegexOptions.CultureInvariant);
if (false == regexRequiredString.Match(this.RequiredString).Success)
{
yield return new ValidationResult(@"Invalid value for RequiredString, must match a pattern of /^[A-Za-z0-9\\u4E00-\\u9FA5][A-Za-z0-9\\(\\)\\(\\)\\u4E00-\\u9FA5]{1,19}$/.", new [] { "RequiredString" });
}
// NonRequiredString (string) maxLength
if(this.NonRequiredString != null && this.NonRequiredString.Length > 20)
{
yield return new ValidationResult("Invalid value for NonRequiredString, length must be less than 20.", new [] { "NonRequiredString" });
}
// NonRequiredString (string) minLength
if(this.NonRequiredString != null && this.NonRequiredString.Length < 2)
{
yield return new ValidationResult("Invalid value for NonRequiredString, length must be greater than 2.", new [] { "NonRequiredString" });
}
yield break;
}
}
#pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null'
}