/*
 * 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
{
    /// <summary>
    /// Package
    /// </summary>
    [DataContract(Name = "Package")]
    public partial class Package : IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Package" /> class.
        /// </summary>
        /// <param name="id">id.</param>
        /// <param name="name">name.</param>
        /// <param name="description">description.</param>
        /// <param name="imageUrl">imageUrl.</param>
        /// <param name="authorId">authorId.</param>
        /// <param name="varVersion">varVersion.</param>
        /// <param name="fileUrl">fileUrl.</param>
        /// <param name="rawSize">rawSize.</param>
        /// <param name="downloadCount">downloadCount.</param>
        /// <param name="lastDownload">lastDownload.</param>
        /// <param name="created">created.</param>
        /// <param name="updated">updated.</param>
        public Package(string id = default(string), string name = default(string), string description = default(string), string imageUrl = default(string), string authorId = default(string), string varVersion = default(string), string fileUrl = default(string), double rawSize = default(double), int downloadCount = default(int), DateTime? lastDownload = default(DateTime?), DateTime created = default(DateTime), DateTime? updated = default(DateTime?))
        {
            this.Id = id;
            this.Name = name;
            this.Description = description;
            this.ImageUrl = imageUrl;
            this.AuthorId = authorId;
            this.VarVersion = varVersion;
            this.FileUrl = fileUrl;
            this.RawSize = rawSize;
            this.DownloadCount = downloadCount;
            this.LastDownload = lastDownload;
            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", EmitDefaultValue = true)]
        public string Name { get; set; }

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

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

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

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

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

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

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

        /// <summary>
        /// Gets or Sets LastDownload
        /// </summary>
        [DataMember(Name = "last_download", EmitDefaultValue = true)]
        public DateTime? LastDownload { 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 Package {\n");
            sb.Append("  Id: ").Append(Id).Append("\n");
            sb.Append("  Name: ").Append(Name).Append("\n");
            sb.Append("  Description: ").Append(Description).Append("\n");
            sb.Append("  ImageUrl: ").Append(ImageUrl).Append("\n");
            sb.Append("  AuthorId: ").Append(AuthorId).Append("\n");
            sb.Append("  VarVersion: ").Append(VarVersion).Append("\n");
            sb.Append("  FileUrl: ").Append(FileUrl).Append("\n");
            sb.Append("  RawSize: ").Append(RawSize).Append("\n");
            sb.Append("  DownloadCount: ").Append(DownloadCount).Append("\n");
            sb.Append("  LastDownload: ").Append(LastDownload).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" });
            }

            yield break;
        }
    }

}
