<commit_before>// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ViewFeatures;

namespace Microsoft.AspNetCore.Mvc.Rendering;

/// <summary>
/// An <see cref="IHtmlHelper"/> for Linq expressions.
/// </summary>
/// <typeparam name="TModel">The type of the model.</typeparam>
public interface IHtmlHelper<TModel> : IHtmlHelper
{
    /// <summary>
    /// Gets the current view data.
    /// </summary>
    new ViewDataDictionary<TModel> ViewData { get; }

    /// <summary>
    /// Returns an &lt;input&gt; element of type "checkbox" with value "true" and an &lt;input&gt; element of type
    /// "hidden" with value "false" for the specified <paramref name="expression"/>. Adds a "checked" attribute to
    /// the "checkbox" element based on the first non-<c>null</c> value found in:
    /// the <paramref name="htmlAttributes"/> dictionary entry with key "checked", or
    /// the <see cref="ActionContext.ModelState"/> entry with full name.
    /// If <paramref name="expression"/> evaluates to a non-<c>null</c> value, instead uses the first
    /// non-<c>null</c> value found in:
    /// the <see cref="ActionContext.ModelState"/> entry with full name, or
    /// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.Model"/>.
    /// See <see cref="NameFor"/> for more information about a "full name".
    /// </summary>
    /// <param name="expression">An expression to be evaluated against the current model.</param>
    /// <param name="htmlAttributes">
    /// An <see cref="object"/> that contains the HTML attributes for the checkbox element. Alternatively, an
    /// <see cref="IDictionary{String, Object}"/> instance containing the HTML attributes.
    /// </param>
    /// <returns>A new <see cref="IHtmlContent"/> containing the &lt;input&gt; elements.</returns>
    /// <remarks>
    /// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
    /// <paramref name="expression"/> to set checkbox element's "name" attribute. Sanitizes the string
    /// representation of the <paramref name="expression"/> to set checkbox element's "id" attribute.
    /// </remarks>
    IHtmlContent CheckBoxFor(Expression<Func<TModel, bool>> expression, object htmlAttributes);

    /// <summary>
    /// Returns HTML markup for the <paramref name="expression"/>, using a display template, specified HTML field
    /// name, and additional view data. The template is found using the <paramref name="templateName"/> or the
    /// <paramref name="expression"/>'s <see cref="ModelBinding.ModelMetadata"/>.
    /// </summary>
    /// <param name="expression">An expression to be evaluated against the current model.</param><commit_msg>DisplayFor: what if template file is not found (#38731)<commit_after>// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ViewFeatures;

namespace Microsoft.AspNetCore.Mvc.Rendering;

/// <summary>
/// An <see cref="IHtmlHelper"/> for Linq expressions.
/// </summary>
/// <typeparam name="TModel">The type of the model.</typeparam>
public interface IHtmlHelper<TModel> : IHtmlHelper
{
    /// <summary>
    /// Gets the current view data.
    /// </summary>
    new ViewDataDictionary<TModel> ViewData { get; }

    /// <summary>
    /// Returns an &lt;input&gt; element of type "checkbox" with value "true" and an &lt;input&gt; element of type
    /// "hidden" with value "false" for the specified <paramref name="expression"/>. Adds a "checked" attribute to
    /// the "checkbox" element based on the first non-<c>null</c> value found in:
    /// the <paramref name="htmlAttributes"/> dictionary entry with key "checked", or
    /// the <see cref="ActionContext.ModelState"/> entry with full name.
    /// If <paramref name="expression"/> evaluates to a non-<c>null</c> value, instead uses the first
    /// non-<c>null</c> value found in:
    /// the <see cref="ActionContext.ModelState"/> entry with full name, or
    /// the <paramref name="expression"/> evaluated against <see cref="ViewDataDictionary.Model"/>.
    /// See <see cref="NameFor"/> for more information about a "full name".
    /// </summary>
    /// <param name="expression">An expression to be evaluated against the current model.</param>
    /// <param name="htmlAttributes">
    /// An <see cref="object"/> that contains the HTML attributes for the checkbox element. Alternatively, an
    /// <see cref="IDictionary{String, Object}"/> instance containing the HTML attributes.
    /// </param>
    /// <returns>A new <see cref="IHtmlContent"/> containing the &lt;input&gt; elements.</returns>
    /// <remarks>
    /// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
    /// <paramref name="expression"/> to set checkbox element's "name" attribute. Sanitizes the string
    /// representation of the <paramref name="expression"/> to set checkbox element's "id" attribute.
    /// </remarks>
    IHtmlContent CheckBoxFor(Expression<Func<TModel, bool>> expression, object htmlAttributes);

    /// <summary>
    /// Returns HTML markup for the <paramref name="expression"/>, using a display template, specified HTML field
    /// name, and additional view data. The template name is taken from the <paramref name="templateName"/> or the
    /// <paramref name="expression"/>’s <see cref="ModelBinding.ModelMetadata"/>.
    /// If the template file is not found, a default template will be used.
    /// </summary>
    /// <param name="expression">An expression to be evaluated against the current model.</param>
{'fraction_non_alphanumeric': 0.14092276830491474, 'fraction_numerical': 0.0008358408559010365, 'mean_word_length': 3.4516369047619047, 'pattern_counts': {'":': 0, '<': 101, '<?xml version=': 0, '>': 101, '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': '11189', 'n_tokens_mistral': 1576, 'n_tokens_neox': 1574, 'n_words': 603}