/*
 * Tribufu API
 *
 * API to access Tribufu services.
 *
 * The version of the OpenAPI document: 1.2.6
 * 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.Client.OpenAPIDateConverter;

namespace Tribufu.Model
{
    /// <summary>
    /// ModelClient
    /// </summary>
    [DataContract(Name = "varClient")]
    public partial class ModelClient : IValidatableObject
    {

        /// <summary>
        /// Gets or Sets Type
        /// </summary>
        [DataMember(Name = "type", EmitDefaultValue = false)]
        public ClientType? Type { get; set; }
        /// <summary>
        /// Initializes a new instance of the <see cref="ModelClient" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected ModelClient() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="ModelClient" /> class.
        /// </summary>
        /// <param name="id">id.</param>
        /// <param name="name">name (required).</param>
        /// <param name="type">type.</param>
        /// <param name="organizationId">organizationId.</param>
        /// <param name="trusted">trusted.</param>
        /// <param name="websiteUrl">websiteUrl.</param>
        /// <param name="photoUrl">photoUrl.</param>
        /// <param name="backgroundUrl">backgroundUrl.</param>
        /// <param name="redirects">redirects.</param>
        /// <param name="scopes">scopes.</param>
        /// <param name="created">created.</param>
        /// <param name="updated">updated.</param>
        public ModelClient(string id = default(string), string name = default(string), ClientType? type = default(ClientType?), string organizationId = default(string), bool trusted = default(bool), string websiteUrl = default(string), string photoUrl = default(string), string backgroundUrl = default(string), string redirects = default(string), string scopes = default(string), DateTime created = default(DateTime), DateTime? updated = default(DateTime?))
        {
            // to ensure "name" is required (not null)
            if (name == null)
            {
                throw new ArgumentNullException("name is a required property for ModelClient and cannot be null");
            }
            this.Name = name;
            this.Id = id;
            this.Type = type;
            this.OrganizationId = organizationId;
            this.Trusted = trusted;
            this.WebsiteUrl = websiteUrl;
            this.PhotoUrl = photoUrl;
            this.BackgroundUrl = backgroundUrl;
            this.Redirects = redirects;
            this.Scopes = scopes;
            this.Created = created;
            this.Updated = updated;
        }

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

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

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

        /// <summary>
        /// Gets or Sets Trusted
        /// </summary>
        [DataMember(Name = "trusted", EmitDefaultValue = true)]
        public bool Trusted { get; set; }

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

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

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

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

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

        /// <summary>
        /// Gets or Sets Permissions
        /// </summary>
        [DataMember(Name = "permissions", EmitDefaultValue = true)]
        public List<string> Permissions { get; private set; }

        /// <summary>
        /// Returns false as Permissions should not be serialized given that it's read-only.
        /// </summary>
        /// <returns>false (boolean)</returns>
        public bool ShouldSerializePermissions()
        {
            return false;
        }
        /// <summary>
        /// Gets or Sets Created
        /// </summary>
        [DataMember(Name = "created", EmitDefaultValue = false)]
        public DateTime Created { get; set; }

        /// <summary>
        /// Gets or Sets Updated
        /// </summary>
        [DataMember(Name = "updated", EmitDefaultValue = true)]
        public DateTime? Updated { 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 ModelClient {\n");
            sb.Append("  Id: ").Append(Id).Append("\n");
            sb.Append("  Name: ").Append(Name).Append("\n");
            sb.Append("  Type: ").Append(Type).Append("\n");
            sb.Append("  OrganizationId: ").Append(OrganizationId).Append("\n");
            sb.Append("  Trusted: ").Append(Trusted).Append("\n");
            sb.Append("  WebsiteUrl: ").Append(WebsiteUrl).Append("\n");
            sb.Append("  PhotoUrl: ").Append(PhotoUrl).Append("\n");
            sb.Append("  BackgroundUrl: ").Append(BackgroundUrl).Append("\n");
            sb.Append("  Redirects: ").Append(Redirects).Append("\n");
            sb.Append("  Scopes: ").Append(Scopes).Append("\n");
            sb.Append("  Permissions: ").Append(Permissions).Append("\n");
            sb.Append("  Created: ").Append(Created).Append("\n");
            sb.Append("  Updated: ").Append(Updated).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>
        /// To validate all properties of the instance
        /// </summary>
        /// <param name="validationContext">Validation context</param>
        /// <returns>Validation Result</returns>
        IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            // Name (string) maxLength
            if (this.Name != null && this.Name.Length > 75)
            {
                yield return new ValidationResult("Invalid value for Name, length must be less than 75.", new [] { "Name" });
            }

            // PhotoUrl (string) maxLength
            if (this.PhotoUrl != null && this.PhotoUrl.Length > 255)
            {
                yield return new ValidationResult("Invalid value for PhotoUrl, length must be less than 255.", new [] { "PhotoUrl" });
            }

            // BackgroundUrl (string) maxLength
            if (this.BackgroundUrl != null && this.BackgroundUrl.Length > 255)
            {
                yield return new ValidationResult("Invalid value for BackgroundUrl, length must be less than 255.", new [] { "BackgroundUrl" });
            }

            yield break;
        }
    }

}
