/// <summary>Generates the type.</summary>
        /// <param name="fallbackTypeName">The fallback type name.</param>
        /// <returns>The code.</returns>
        public override TypeGeneratorResult GenerateType(string fallbackTypeName)
        {
            var typeName = _schema.GetTypeName(Settings.TypeNameGenerator);

            if (string.IsNullOrEmpty(typeName))
            {
                typeName = fallbackTypeName;
            }

            if (_schema.IsEnumeration)
            {
                if (_schema.Type == JsonObjectType.Integer)
                {
                    typeName = typeName + "AsInteger";
                }

                var template = new EnumTemplate() as ITemplate;
                template.Initialize(new EnumTemplateModel(typeName, _schema));
                return(new TypeGeneratorResult
                {
                    TypeName = typeName,
                    Code = template.Render()
                });
            }
            else
            {
                var properties     = _schema.AllProperties.Values.Select(property => new PropertyModel(property, typeName, _resolver, Settings)).ToList();
                var hasInheritance = _schema.InheritedSchemas.Count >= 1;
                var baseClass      = hasInheritance ? _resolver.Resolve(_schema.InheritedSchemas.First(), true, string.Empty) : null;

                var derivedClassNames = _schema.GetDerivedSchemas(RootObject, _resolver)
                                        .Where(s => s.Value.Inherits(_schema))
                                        .Select(s => s.Key)
                                        .ToList();

                var template = Settings.CreateTemplate(typeName);
                template.Initialize(new // TODO: Create model class
                {
                    Class             = Settings.ExtendedClasses?.Contains(typeName) == true ? typeName + "Base" : typeName,
                    RealClass         = typeName,
                    DerivedClassNames = derivedClassNames,
                    DerivedClassNamesWithPropertyCheck = derivedClassNames.Where(n => properties.All(p => p.PropertyName != n)),

                    HasDiscriminator      = !string.IsNullOrEmpty(_schema.BaseDiscriminator),
                    Discriminator         = _schema.BaseDiscriminator,
                    DiscriminatorProperty = GetDiscriminatorProperty(_schema),

                    HasDescription = !(_schema is JsonProperty) && !string.IsNullOrEmpty(_schema.Description),
                    Description    = ConversionUtilities.RemoveLineBreaks(_schema.Description),

                    HasInheritance = hasInheritance,
                    Inheritance    = hasInheritance ? " extends " + baseClass : string.Empty,
                    Properties     = properties
                });

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