<commit_before>using System;
using DotVVM.Framework.Compilation;

namespace DotVVM.Framework.Configuration
{
    public sealed class ViewCompilationConfiguration
    {
        private bool isFrozen = false;
        private ViewCompilationMode mode;
        /// <summary>
        /// Gets or sets the mode under which the view compilation (pages, controls, ... ) is done.
        /// </summary>
        public ViewCompilationMode Mode
        {
            get => mode;
            set {
                ThrowIfFrozen();
                mode = value;
            }
        }

        private TimeSpan? backgroundCompilationDelay;
        /// <summary>
        /// Gets or sets the delay before view compilation will be done. This compilation delay can be set only in precompilation modes.
        /// </summary>
        public TimeSpan? BackgroundCompilationDelay
        {
            get => backgroundCompilationDelay;
            set
            {
                ThrowIfFrozen();
                backgroundCompilationDelay = value;
            }
        }
        private bool compileInParallel = true;
        /// <summary>
        /// Gets or sets whether the view compilation will be performed in parallel or in series.
        /// </summary>
        public bool CompileInParallel
        {
            get => compileInParallel;
            set
            {
                ThrowIfFrozen();
                compileInParallel = value;
            }
        }

        public void Validate()
        {
            if (BackgroundCompilationDelay.HasValue && Mode == ViewCompilationMode.Lazy)
            {
                throw new Exception($"{nameof(BackgroundCompilationDelay)} is not supported in {nameof(ViewCompilationMode.Lazy)} {nameof(Mode)}.");
            }
        }
        
        public void Freeze()
        {
            Validate();<commit_msg>Added JsonProperty attributes to ViewCompilationConfiguration.<commit_after>using System;
using DotVVM.Framework.Compilation;
using Newtonsoft.Json;

namespace DotVVM.Framework.Configuration
{
    public sealed class ViewCompilationConfiguration
    {
        private bool isFrozen = false;
        private ViewCompilationMode mode;
        /// <summary>
        /// Gets or sets the mode under which the view compilation (pages, controls, ... ) is done.
        /// </summary>
        [JsonProperty("mode")]
        public ViewCompilationMode Mode
        {
            get => mode;
            set {
                ThrowIfFrozen();
                mode = value;
            }
        }

        private TimeSpan? backgroundCompilationDelay;
        /// <summary>
        /// Gets or sets the delay before view compilation will be done. This compilation delay can be set only in precompilation modes.
        /// </summary>
        [JsonProperty("backgroundCompilationDelay")]
        public TimeSpan? BackgroundCompilationDelay
        {
            get => backgroundCompilationDelay;
            set
            {
                ThrowIfFrozen();
                backgroundCompilationDelay = value;
            }
        }
        private bool compileInParallel = true;
        /// <summary>
        /// Gets or sets whether the view compilation will be performed in parallel or in series.
        /// </summary>
        [JsonProperty("compileInParallel")]
        public bool CompileInParallel
        {
            get => compileInParallel;
            set
            {
                ThrowIfFrozen();
                compileInParallel = value;
            }
        }

        public void Validate()
        {
            if (BackgroundCompilationDelay.HasValue && Mode == ViewCompilationMode.Lazy)
            {
                throw new Exception($"{nameof(BackgroundCompilationDelay)} is not supported in {nameof(ViewCompilationMode.Lazy)} {nameof(Mode)}.");
            }
        }
        
        public void Freeze()
        {
            Validate();
{'fraction_non_alphanumeric': 0.0806205493387589, 'fraction_numerical': 0.0, 'mean_word_length': 1.5977542932628799, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4823937', 'n_tokens_mistral': 921, 'n_tokens_neox': 911, 'n_words': 262}