/// <summary>Generates the file.</summary>
        /// <returns>The file contents.</returns>
        public override string GenerateFile()
        {
            var classes  = GenerateType(_resolver.GenerateTypeName()).Code + "\n\n" + _resolver.GenerateTypes();
            var template = new FileTemplate() as ITemplate;

            template.Initialize(new FileTemplateModel
            {
                Namespace = Settings.Namespace ?? string.Empty,
                Classes   = ConversionUtilities.TrimWhiteSpaces(classes)
            });
            return(template.Render());
        }
        /// <summary>Generates the type.</summary>
        /// <param name="typeNameHint">The type name hint.</param>
        /// <returns>The code.</returns>
        public override TypeGeneratorResult GenerateType(string typeNameHint)
        {
            var typeName = !string.IsNullOrEmpty(_schema.TypeName) ? _schema.TypeName : _resolver.GenerateTypeName(typeNameHint);

            if (_schema.IsEnumeration)
            {
                var template = LoadTemplate("Enum");
                template.Add("name", typeName);
                template.Add("enums", GetEnumeration());

                template.Add("hasDescription", !(_schema is JsonProperty) && !string.IsNullOrEmpty(_schema.Description));
                template.Add("description", RemoveLineBreaks(_schema.Description));

                return(new TypeGeneratorResult
                {
                    TypeName = typeName,
                    Code = template.Render()
                });
            }
            else
            {
                var properties = _schema.Properties.Values.Select(property => new
                {
                    Name = property.Name,

                    HasDescription = !string.IsNullOrEmpty(property.Description),
                    Description    = RemoveLineBreaks(property.Description),

                    PropertyName = ConvertToUpperCamelCase(property.Name),
                    FieldName    = ConvertToLowerCamelCase(property.Name),

                    Required     = property.IsRequired && Settings.RequiredPropertiesMustBeDefined ? "Required.Always" : "Required.Default",
                    IsStringEnum = property.ActualSchema.IsEnumeration && property.ActualSchema.Type == JsonObjectType.String,

                    Type = _resolver.Resolve(property, property.Type.HasFlag(JsonObjectType.Null), property.Name)
                }).ToList();

                var template = LoadTemplate("Class");
                template.Add("namespace", Settings.Namespace);
                template.Add("class", typeName);

                template.Add("hasDescription", !(_schema is JsonProperty) && !string.IsNullOrEmpty(_schema.Description));
                template.Add("description", RemoveLineBreaks(_schema.Description));
                template.Add("inpc", Settings.ClassStyle == CSharpClassStyle.Inpc);

                template.Add("inheritance", _schema.AllOf.Count == 1 ?
                             ": " + _resolver.Resolve(_schema.AllOf.First(), false, string.Empty) +
                             (Settings.ClassStyle == CSharpClassStyle.Inpc ? ", INotifyPropertyChanged" : "") :
                             (Settings.ClassStyle == CSharpClassStyle.Inpc ? ": INotifyPropertyChanged" : ""));
                template.Add("properties", properties);

                return(new TypeGeneratorResult
                {
                    TypeName = typeName,
                    Code = template.Render()
                });
            }
        }