/*
* 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'
///
/// ApiCreateCompanyInputModel
///
[DataContract]
public partial class ApiCreateCompanyInputModel : IEquatable, IValidatableObject //Mark 555
{
///
/// 2. Initializes a new instance of the class.
///
[JsonConstructorAttribute]
protected ApiCreateCompanyInputModel() { }
///
/// Not Enum: Gets or Sets Name
///
[DataMember(Name="Name", 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-sensitive-word=true, x-regex-regex=^[A-Za-z0-9\u4E00-\u9FA5][A-Za-z0-9\(\)\(\)\u4E00-\u9FA5]{1,19}$, x-modifiers=[CultureInvariant]}
public string Name { get; set; }
///
/// Not Enum: Gets or Sets Description
///
[DataMember(Name="Description", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-required=请输入公司简介, x-min-length=公司简介至少1个字符, x-string-length-min=1, x-display-name=公司简介, x-sensitive-word=true}
public string Description { get; set; }
///
/// Not Enum: Gets or Sets MainBusiness
///
[DataMember(Name="MainBusiness", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-string-length-max=300, x-display-name=公司主营, x-max-length=公司主营字符长度不能超过300个}
public string MainBusiness { get; set; }
///
/// Not Enum: Gets or Sets Logo
///
[DataMember(Name="Logo", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-string-length-max=200, x-display-name=公司Logo, x-max-length=公司Logo字符长度不能超过200个}
public string Logo { get; set; }
///
/// Not Enum: Gets or Sets RegionId
///
[DataMember(Name="RegionId", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-required=请输入二级地区, x-range=二级地区必须不小于1, x-range-min=1, x-display-name=二级地区, x-isnullable=false}
public int? RegionId { get; set; }
///
/// Not Enum: Gets or Sets IndustryId
///
[DataMember(Name="IndustryId", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-required=请输入所属行业, x-range=所属行业必须不小于1, x-range-min=1, x-display-name=所属行业, x-isnullable=false}
public int? IndustryId { get; set; }
///
/// Not Enum: Gets or Sets Address
///
[DataMember(Name="Address", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-string-length=详细地址必须1到50字符, x-string-length-min=1, x-string-length-max=50, x-display-name=详细地址, x-sensitive-word=true}
public string Address { get; set; }
///
/// Not Enum: Gets or Sets RealName
///
[DataMember(Name="RealName", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-required=请输入联系人, x-string-length-max=4, x-display-name=联系人, x-max-length=联系人最长不超过4字, x-sensitive-word=true}
public string RealName { get; set; }
///
/// Not Enum: Gets or Sets Telephone
///
[DataMember(Name="Telephone", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-display-name=固定电话, x-regex=([48]00\\d{7})|([48]00-\\d{7})|([48]00-\\d{2}-\\d{5})|([48]00-\\d{3}-\\d{4})|([48]00-\\d{4}-\\d{3})|([48]00-\\d{5}-\\d{2})|([48]00\\d{1}-\\d{3}-\\d{3})|([48]00\\s\\d{3}\\s\\d{4})|(^0\\d{2,3}-?\\d{7,8}), x-regex-regex=([48]00\d{7})|([48]00-\d{7})|([48]00-\d{2}-\d{5})|([48]00-\d{3}-\d{4})|([48]00-\d{4}-\d{3})|([48]00-\d{5}-\d{2})|([48]00\d{1}-\d{3}-\d{3})|([48]00\s\d{3}\s\d{4})|(^0\d{2,3}-?\d{7,8}), x-modifiers=[CultureInvariant]}
public string Telephone { get; set; }
///
/// Not Enum: Gets or Sets Fax
///
[DataMember(Name="Fax", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-display-name=传真, x-regex=\\+?0\\d{2,3}\\s*[- ]?\\s*\\d{7,8}, x-regex-regex=\+?0\d{2,3}\s*[- ]?\s*\d{7,8}, x-modifiers=[CultureInvariant]}
public string Fax { get; set; }
///
/// Not Enum: Gets or Sets Mobile
///
[DataMember(Name="Mobile", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-required=请输入手机号, x-display-name=手机号, x-regex=^1[3456789]\\d{9}$, x-regex-regex=^1[3456789]\d{9}$, x-modifiers=[CultureInvariant]}
public string Mobile { get; set; }
///
/// Not Enum: Gets or Sets EMail
///
[DataMember(Name="E_Mail", EmitDefaultValue=false)] //Mark 1 vendorExtensions: {x-display-name=邮箱, x-regex=[\\w!#$%&'*+\/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+\/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[\\w](?:[\\w-]*[\\w])?, x-regex-regex=[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?, x-modifiers=[CultureInvariant]}
public string EMail { 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 ApiCreateCompanyInputModel {\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" Description: ").Append(Description).Append("\n");
sb.Append(" MainBusiness: ").Append(MainBusiness).Append("\n");
sb.Append(" Logo: ").Append(Logo).Append("\n");
sb.Append(" RegionId: ").Append(RegionId).Append("\n");
sb.Append(" IndustryId: ").Append(IndustryId).Append("\n");
sb.Append(" Address: ").Append(Address).Append("\n");
sb.Append(" RealName: ").Append(RealName).Append("\n");
sb.Append(" Telephone: ").Append(Telephone).Append("\n");
sb.Append(" Fax: ").Append(Fax).Append("\n");
sb.Append(" Mobile: ").Append(Mobile).Append("\n");
sb.Append(" EMail: ").Append(EMail).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 ApiCreateCompanyInputModel);
}
///
/// Returns true if ApiCreateCompanyInputModel instances are equal
///
/// Instance of ApiCreateCompanyInputModel to be compared
/// Boolean
public bool Equals(ApiCreateCompanyInputModel other)
{
// credit: http://stackoverflow.com/a/10454552/677735
if (other == null)
return false;
return
(
this.Name == other.Name ||
this.Name != null &&
this.Name.Equals(other.Name)
) &&
(
this.Description == other.Description ||
this.Description != null &&
this.Description.Equals(other.Description)
) &&
(
this.MainBusiness == other.MainBusiness ||
this.MainBusiness != null &&
this.MainBusiness.Equals(other.MainBusiness)
) &&
(
this.Logo == other.Logo ||
this.Logo != null &&
this.Logo.Equals(other.Logo)
) &&
(
this.RegionId == other.RegionId ||
this.RegionId != null &&
this.RegionId.Equals(other.RegionId)
) &&
(
this.IndustryId == other.IndustryId ||
this.IndustryId != null &&
this.IndustryId.Equals(other.IndustryId)
) &&
(
this.Address == other.Address ||
this.Address != null &&
this.Address.Equals(other.Address)
) &&
(
this.RealName == other.RealName ||
this.RealName != null &&
this.RealName.Equals(other.RealName)
) &&
(
this.Telephone == other.Telephone ||
this.Telephone != null &&
this.Telephone.Equals(other.Telephone)
) &&
(
this.Fax == other.Fax ||
this.Fax != null &&
this.Fax.Equals(other.Fax)
) &&
(
this.Mobile == other.Mobile ||
this.Mobile != null &&
this.Mobile.Equals(other.Mobile)
) &&
(
this.EMail == other.EMail ||
this.EMail != null &&
this.EMail.Equals(other.EMail)
);
}
///
/// 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.Name != null)
hash = hash * 59 + this.Name.GetHashCode();
if (this.Description != null)
hash = hash * 59 + this.Description.GetHashCode();
if (this.MainBusiness != null)
hash = hash * 59 + this.MainBusiness.GetHashCode();
if (this.Logo != null)
hash = hash * 59 + this.Logo.GetHashCode();
if (this.RegionId != null)
hash = hash * 59 + this.RegionId.GetHashCode();
if (this.IndustryId != null)
hash = hash * 59 + this.IndustryId.GetHashCode();
if (this.Address != null)
hash = hash * 59 + this.Address.GetHashCode();
if (this.RealName != null)
hash = hash * 59 + this.RealName.GetHashCode();
if (this.Telephone != null)
hash = hash * 59 + this.Telephone.GetHashCode();
if (this.Fax != null)
hash = hash * 59 + this.Fax.GetHashCode();
if (this.Mobile != null)
hash = hash * 59 + this.Mobile.GetHashCode();
if (this.EMail != null)
hash = hash * 59 + this.EMail.GetHashCode();
return hash;
}
}
public IEnumerable Validate(ValidationContext validationContext)
{
// Name (string) maxLength
if(this.Name != null && this.Name.Length > 20)
{
yield return new ValidationResult("Invalid value for Name, length must be less than 20.", new [] { "Name" });
}
// Name (string) minLength
if(this.Name != null && this.Name.Length < 2)
{
yield return new ValidationResult("Invalid value for Name, length must be greater than 2.", new [] { "Name" });
}
// Name (string) pattern
Regex regexName = new Regex(@"^[A-Za-z0-9\\u4E00-\\u9FA5][A-Za-z0-9\\(\\)\\(\\)\\u4E00-\\u9FA5]{1,19}$", RegexOptions.CultureInvariant);
if (false == regexName.Match(this.Name).Success)
{
yield return new ValidationResult(@"Invalid value for Name, must match a pattern of /^[A-Za-z0-9\\u4E00-\\u9FA5][A-Za-z0-9\\(\\)\\(\\)\\u4E00-\\u9FA5]{1,19}$/.", new [] { "Name" });
}
// RegionId (int?) maximum
if(this.RegionId > (int?)2147483647)
{
yield return new ValidationResult("Invalid value for RegionId, must be a value less than or equal to 2147483647.", new [] { "RegionId" });
}
// RegionId (int?) minimum
if(this.RegionId < (int?)1)
{
yield return new ValidationResult("Invalid value for RegionId, must be a value greater than or equal to 1.", new [] { "RegionId" });
}
// IndustryId (int?) maximum
if(this.IndustryId > (int?)2147483647)
{
yield return new ValidationResult("Invalid value for IndustryId, must be a value less than or equal to 2147483647.", new [] { "IndustryId" });
}
// IndustryId (int?) minimum
if(this.IndustryId < (int?)1)
{
yield return new ValidationResult("Invalid value for IndustryId, must be a value greater than or equal to 1.", new [] { "IndustryId" });
}
// Address (string) maxLength
if(this.Address != null && this.Address.Length > 50)
{
yield return new ValidationResult("Invalid value for Address, length must be less than 50.", new [] { "Address" });
}
// Address (string) minLength
if(this.Address != null && this.Address.Length < 1)
{
yield return new ValidationResult("Invalid value for Address, length must be greater than 1.", new [] { "Address" });
}
// Telephone (string) pattern
Regex regexTelephone = new Regex(@"([48]00\\d{7})|([48]00-\\d{7})|([48]00-\\d{2}-\\d{5})|([48]00-\\d{3}-\\d{4})|([48]00-\\d{4}-\\d{3})|([48]00-\\d{5}-\\d{2})|([48]00\\d{1}-\\d{3}-\\d{3})|([48]00\\s\\d{3}\\s\\d{4})|(^0\\d{2,3}-?\\d{7,8})", RegexOptions.CultureInvariant);
if (false == regexTelephone.Match(this.Telephone).Success)
{
yield return new ValidationResult(@"Invalid value for Telephone, must match a pattern of /([48]00\\d{7})|([48]00-\\d{7})|([48]00-\\d{2}-\\d{5})|([48]00-\\d{3}-\\d{4})|([48]00-\\d{4}-\\d{3})|([48]00-\\d{5}-\\d{2})|([48]00\\d{1}-\\d{3}-\\d{3})|([48]00\\s\\d{3}\\s\\d{4})|(^0\\d{2,3}-?\\d{7,8})/.", new [] { "Telephone" });
}
// Fax (string) pattern
Regex regexFax = new Regex(@"\\+?0\\d{2,3}\\s*[- ]?\\s*\\d{7,8}", RegexOptions.CultureInvariant);
if (false == regexFax.Match(this.Fax).Success)
{
yield return new ValidationResult(@"Invalid value for Fax, must match a pattern of /\\+?0\\d{2,3}\\s*[- ]?\\s*\\d{7,8}/.", new [] { "Fax" });
}
// Mobile (string) pattern
Regex regexMobile = new Regex(@"^1[3456789]\\d{9}$", RegexOptions.CultureInvariant);
if (false == regexMobile.Match(this.Mobile).Success)
{
yield return new ValidationResult(@"Invalid value for Mobile, must match a pattern of /^1[3456789]\\d{9}$/.", new [] { "Mobile" });
}
// EMail (string) pattern
Regex regexEMail = new Regex(@"[\\w!#$%&'*+\/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+\/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[\\w](?:[\\w-]*[\\w])?", RegexOptions.CultureInvariant);
if (false == regexEMail.Match(this.EMail).Success)
{
yield return new ValidationResult(@"Invalid value for EMail, must match a pattern of /[\\w!#$%&'*+\/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+\/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[\\w](?:[\\w-]*[\\w])?/.", new [] { "EMail" });
}
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'
}