| | 1 | | // <auto-generated> |
| | 2 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 3 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 4 | | // regenerated. |
| | 5 | | // </auto-generated> |
| | 6 | |
|
| | 7 | | namespace Microsoft.Azure.CognitiveServices.Search.EntitySearch.Models |
| | 8 | | { |
| | 9 | | using Microsoft.Rest; |
| | 10 | | using Newtonsoft.Json; |
| | 11 | | using System.Linq; |
| | 12 | |
|
| | 13 | | /// <summary> |
| | 14 | | /// Defines a contractual rule for text attribution. |
| | 15 | | /// </summary> |
| | 16 | | [Newtonsoft.Json.JsonObject("ContractualRules/TextAttribution")] |
| | 17 | | public partial class ContractualRulesTextAttribution : ContractualRulesAttribution |
| | 18 | | { |
| | 19 | | /// <summary> |
| | 20 | | /// Initializes a new instance of the ContractualRulesTextAttribution |
| | 21 | | /// class. |
| | 22 | | /// </summary> |
| 0 | 23 | | public ContractualRulesTextAttribution() |
| | 24 | | { |
| | 25 | | CustomInit(); |
| 0 | 26 | | } |
| | 27 | |
|
| | 28 | | /// <summary> |
| | 29 | | /// Initializes a new instance of the ContractualRulesTextAttribution |
| | 30 | | /// class. |
| | 31 | | /// </summary> |
| | 32 | | /// <param name="text">The attribution text. Text attribution applies |
| | 33 | | /// to the entity as a whole and should be displayed immediately |
| | 34 | | /// following the entity presentation. If there are multiple text or |
| | 35 | | /// link attribution rules that do not specify a target, you should |
| | 36 | | /// concatenate them and display them using a "Data from:" |
| | 37 | | /// label.</param> |
| | 38 | | /// <param name="targetPropertyName">The name of the field that the |
| | 39 | | /// rule applies to.</param> |
| | 40 | | /// <param name="mustBeCloseToContent">A Boolean value that determines |
| | 41 | | /// whether the contents of the rule must be placed in close proximity |
| | 42 | | /// to the field that the rule applies to. If true, the contents must |
| | 43 | | /// be placed in close proximity. If false, or this field does not |
| | 44 | | /// exist, the contents may be placed at the caller's |
| | 45 | | /// discretion.</param> |
| | 46 | | /// <param name="optionalForListDisplay">Indicates whether this |
| | 47 | | /// provider's attribution is optional.</param> |
| | 48 | | public ContractualRulesTextAttribution(string text, string targetPropertyName = default(string), bool? mustBeClo |
| 0 | 49 | | : base(targetPropertyName, mustBeCloseToContent) |
| | 50 | | { |
| 0 | 51 | | Text = text; |
| 0 | 52 | | OptionalForListDisplay = optionalForListDisplay; |
| | 53 | | CustomInit(); |
| 0 | 54 | | } |
| | 55 | |
|
| | 56 | | /// <summary> |
| | 57 | | /// An initialization method that performs custom operations like setting defaults |
| | 58 | | /// </summary> |
| | 59 | | partial void CustomInit(); |
| | 60 | |
|
| | 61 | | /// <summary> |
| | 62 | | /// Gets or sets the attribution text. Text attribution applies to the |
| | 63 | | /// entity as a whole and should be displayed immediately following the |
| | 64 | | /// entity presentation. If there are multiple text or link attribution |
| | 65 | | /// rules that do not specify a target, you should concatenate them and |
| | 66 | | /// display them using a "Data from:" label. |
| | 67 | | /// </summary> |
| | 68 | | [JsonProperty(PropertyName = "text")] |
| 0 | 69 | | public string Text { get; set; } |
| | 70 | |
|
| | 71 | | /// <summary> |
| | 72 | | /// Gets indicates whether this provider's attribution is optional. |
| | 73 | | /// </summary> |
| | 74 | | [JsonProperty(PropertyName = "optionalForListDisplay")] |
| 0 | 75 | | public bool? OptionalForListDisplay { get; private set; } |
| | 76 | |
|
| | 77 | | /// <summary> |
| | 78 | | /// Validate the object. |
| | 79 | | /// </summary> |
| | 80 | | /// <exception cref="ValidationException"> |
| | 81 | | /// Thrown if validation fails |
| | 82 | | /// </exception> |
| | 83 | | public virtual void Validate() |
| | 84 | | { |
| 0 | 85 | | if (Text == null) |
| | 86 | | { |
| 0 | 87 | | throw new ValidationException(ValidationRules.CannotBeNull, "Text"); |
| | 88 | | } |
| 0 | 89 | | } |
| | 90 | | } |
| | 91 | | } |