<commit_before>﻿using System.Runtime.Serialization;
using Lime.Protocol;

namespace Lime.Messaging.Contents
{
    /// <summary>
    /// Represents an input request to an user.
    /// </summary>
    /// <seealso cref="Document" />
    [DataContract(Namespace = "http://limeprotocol.org/2014")]
    public class Input : Document
    {
        public const string MIME_TYPE = "application/vnd.lime.input+json";
        public const string LABEL_KEY = "label";
        public const string VALIDATION_KEY = "validation";

        public static readonly MediaType MediaType = MediaType.Parse(MIME_TYPE);

        /// <summary>
        /// Initializes a new instance of the <see cref="Input"/> class.
        /// </summary>
        public Input()
            : base(MediaType)
        {

        }

        /// <summary>
        /// Gets or sets the input label that should be shown to the user.
        /// </summary>
        [DataMember(Name = LABEL_KEY)]
        public DocumentContainer Label { get; set; }

        /// <summary>
        /// Gets or sets the validation rules to be enforced into the user response message for the input.
        /// </summary>
        [DataMember(Name = LABEL_KEY)]
        public InputValidation Validation { get; set; }
    }

    /// <summary>
    /// Provide validation rules for inputs.
    /// </summary>
    [DataContract(Namespace = "http://limeprotocol.org/2014")]
    public class InputValidation
    {
        public const string RULE_KEY = "rule";
        public const string REGEX_KEY = "regex";
        public const string TYPE_KEY = "type";
        public const string ERROR_KEY = "error";

        /// <summary>
        /// Gets or sets the validation rule to be used.
        /// </summary>
        [DataMember(Name = RULE_KEY, IsRequired = true)]
        public InputValidationRule Rule { get; set; }

        /// <summary>
        /// Gets or sets the regular expression to be used in case of the <see cref="Rule"/> value is <see cref="InputValidationRule.Regex"/>.<commit_msg>Added ToString override method to input class<commit_after>﻿using System.Runtime.Serialization;
using Lime.Protocol;

namespace Lime.Messaging.Contents
{
    /// <summary>
    /// Represents an input request to an user.
    /// </summary>
    /// <seealso cref="Document" />
    [DataContract(Namespace = "http://limeprotocol.org/2014")]
    public class Input : Document
    {
        public const string MIME_TYPE = "application/vnd.lime.input+json";
        public const string LABEL_KEY = "label";
        public const string VALIDATION_KEY = "validation";

        public static readonly MediaType MediaType = MediaType.Parse(MIME_TYPE);

        /// <summary>
        /// Initializes a new instance of the <see cref="Input"/> class.
        /// </summary>
        public Input()
            : base(MediaType)
        {

        }

        /// <summary>
        /// Gets or sets the input label that should be shown to the user.
        /// </summary>
        [DataMember(Name = LABEL_KEY, IsRequired = true)]
        public DocumentContainer Label { get; set; }

        /// <summary>
        /// Gets or sets the validation rules to be enforced into the user response message for the input.
        /// </summary>
        [DataMember(Name = LABEL_KEY)]
        public InputValidation Validation { get; set; }

        /// <summary>
        /// Returns a <see cref="System.String" /> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String" /> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            return Label?.ToString() ?? "";
        }
    }

    /// <summary>
    /// Provide validation rules for inputs.
    /// </summary>
    [DataContract(Namespace = "http://limeprotocol.org/2014")]
    public class InputValidation
    {
        public const string RULE_KEY = "rule";
        public const string REGEX_KEY = "regex";
        public const string TYPE_KEY = "type";
        public const string ERROR_KEY = "error";

        /// <summary>
        /// Gets or sets the validation rule to be used.
        /// </summary>
        [DataMember(Name = RULE_KEY, IsRequired = true)]
        public InputValidationRule Rule { get; set; }

        /// <summary>
        /// Gets or sets the regular expression to be used in case of the <see cref="Rule"/> value is <see cref="InputValidationRule.Regex"/>.
{'fraction_non_alphanumeric': 0.12090623598026021, 'fraction_numerical': 0.003589053387169134, 'mean_word_length': 2.0562028786840303, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, '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': '5199775', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1155, 'n_words': 388}