/*
* Tribufu API
*
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
* 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 = Tribufu.Generated.Client.OpenAPIDateConverter;
namespace Tribufu.Generated.Model
{
///
/// RegisterRequest
///
[DataContract(Name = "RegisterRequest")]
public partial class RegisterRequest : IValidatableObject
{
///
/// Initializes a new instance of the class.
///
[JsonConstructorAttribute]
protected RegisterRequest() { }
///
/// Initializes a new instance of the class.
///
/// uuid.
/// name (required).
/// email.
/// password (required).
public RegisterRequest(Guid? uuid = default(Guid?), string name = default(string), string email = default(string), string password = default(string))
{
// to ensure "name" is required (not null)
if (name == null)
{
throw new ArgumentNullException("name is a required property for RegisterRequest and cannot be null");
}
this.Name = name;
// to ensure "password" is required (not null)
if (password == null)
{
throw new ArgumentNullException("password is a required property for RegisterRequest and cannot be null");
}
this.Password = password;
this.Uuid = uuid;
this.Email = email;
}
///
/// Gets or Sets Uuid
///
[DataMember(Name = "uuid", EmitDefaultValue = true)]
public Guid? Uuid { get; set; }
///
/// Gets or Sets Name
///
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)]
public string Name { get; set; }
///
/// Gets or Sets Email
///
[DataMember(Name = "email", EmitDefaultValue = true)]
public string Email { get; set; }
///
/// Gets or Sets Password
///
[DataMember(Name = "password", IsRequired = true, EmitDefaultValue = true)]
public string Password { get; set; }
///
/// Returns the string presentation of the object
///
/// String presentation of the object
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class RegisterRequest {\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" Email: ").Append(Email).Append("\n");
sb.Append(" Password: ").Append(Password).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
///
/// Returns the JSON string presentation of the object
///
/// JSON string presentation of the object
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
///
/// To validate all properties of the instance
///
/// Validation context
/// Validation Result
IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
{
// Name (string) maxLength
if (this.Name != null && this.Name.Length > 45)
{
yield return new ValidationResult("Invalid value for Name, length must be less than 45.", new [] { "Name" });
}
// Name (string) minLength
if (this.Name != null && this.Name.Length < 3)
{
yield return new ValidationResult("Invalid value for Name, length must be greater than 3.", new [] { "Name" });
}
if (this.Name != null) {
// Name (string) pattern
Regex regexName = new Regex(@"^[a-zA-Z0-9-_]*$", RegexOptions.CultureInvariant);
if (!regexName.Match(this.Name).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Name, must match a pattern of " + regexName, new [] { "Name" });
}
}
// Email (string) maxLength
if (this.Email != null && this.Email.Length > 255)
{
yield return new ValidationResult("Invalid value for Email, length must be less than 255.", new [] { "Email" });
}
if (this.Email != null) {
// Email (string) pattern
Regex regexEmail = new Regex(@"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$", RegexOptions.CultureInvariant);
if (!regexEmail.Match(this.Email).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Email, must match a pattern of " + regexEmail, new [] { "Email" });
}
}
// Password (string) minLength
if (this.Password != null && this.Password.Length < 1)
{
yield return new ValidationResult("Invalid value for Password, length must be greater than 1.", new [] { "Password" });
}
yield break;
}
}
}