/*
 * 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>
    /// File
    /// </summary>
    [DataContract(Name = "File")]
    public partial class File : IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="File" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected File() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="File" /> class.
        /// </summary>
        /// <param name="id">id.</param>
        /// <param name="name">name (required).</param>
        /// <param name="contentType">contentType (required).</param>
        /// <param name="url">url (required).</param>
        /// <param name="hash">hash.</param>
        /// <param name="etag">etag.</param>
        /// <param name="size">size.</param>
        /// <param name="created">created.</param>
        /// <param name="updated">updated.</param>
        public File(string id = default(string), string name = default(string), string contentType = default(string), string url = default(string), string hash = default(string), string etag = default(string), long size = default(long), 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 File and cannot be null");
            }
            this.Name = name;
            // to ensure "contentType" is required (not null)
            if (contentType == null)
            {
                throw new ArgumentNullException("contentType is a required property for File and cannot be null");
            }
            this.ContentType = contentType;
            // to ensure "url" is required (not null)
            if (url == null)
            {
                throw new ArgumentNullException("url is a required property for File and cannot be null");
            }
            this.Url = url;
            this.Id = id;
            this.Hash = hash;
            this.Etag = etag;
            this.Size = size;
            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 ContentType
        /// </summary>
        [DataMember(Name = "content_type", IsRequired = true, EmitDefaultValue = true)]
        public string ContentType { get; set; }

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

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

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

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

        /// <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 File {\n");
            sb.Append("  Id: ").Append(Id).Append("\n");
            sb.Append("  Name: ").Append(Name).Append("\n");
            sb.Append("  ContentType: ").Append(ContentType).Append("\n");
            sb.Append("  Url: ").Append(Url).Append("\n");
            sb.Append("  Hash: ").Append(Hash).Append("\n");
            sb.Append("  Etag: ").Append(Etag).Append("\n");
            sb.Append("  Size: ").Append(Size).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 > 45)
            {
                yield return new ValidationResult("Invalid value for Name, length must be less than 45.", new [] { "Name" });
            }

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

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

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

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

            yield break;
        }
    }

}
