|  |  | 1 |  | // <auto-generated> | 
|  |  | 2 |  | // Copyright (c) Microsoft Corporation. All rights reserved. | 
|  |  | 3 |  | // Licensed under the MIT License. See License.txt in the project root for | 
|  |  | 4 |  | // license information. | 
|  |  | 5 |  | // | 
|  |  | 6 |  | // Code generated by Microsoft (R) AutoRest Code Generator. | 
|  |  | 7 |  | // Changes may cause incorrect behavior and will be lost if the code is | 
|  |  | 8 |  | // regenerated. | 
|  |  | 9 |  | // </auto-generated> | 
|  |  | 10 |  |  | 
|  |  | 11 |  | namespace Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models | 
|  |  | 12 |  | { | 
|  |  | 13 |  |     using Microsoft.Rest; | 
|  |  | 14 |  |     using Newtonsoft.Json; | 
|  |  | 15 |  |     using System.Collections; | 
|  |  | 16 |  |     using System.Collections.Generic; | 
|  |  | 17 |  |     using System.Linq; | 
|  |  | 18 |  |  | 
|  |  | 19 |  |     /// <summary> | 
|  |  | 20 |  |     /// An object representing a recognized text line. | 
|  |  | 21 |  |     /// </summary> | 
|  |  | 22 |  |     public partial class Line | 
|  |  | 23 |  |     { | 
|  |  | 24 |  |         /// <summary> | 
|  |  | 25 |  |         /// Initializes a new instance of the Line class. | 
|  |  | 26 |  |         /// </summary> | 
|  | 0 | 27 |  |         public Line() | 
|  |  | 28 |  |         { | 
|  |  | 29 |  |             CustomInit(); | 
|  | 0 | 30 |  |         } | 
|  |  | 31 |  |  | 
|  |  | 32 |  |         /// <summary> | 
|  |  | 33 |  |         /// Initializes a new instance of the Line class. | 
|  |  | 34 |  |         /// </summary> | 
|  |  | 35 |  |         /// <param name="boundingBox">Bounding box of a recognized | 
|  |  | 36 |  |         /// line.</param> | 
|  |  | 37 |  |         /// <param name="text">The text content of the line.</param> | 
|  |  | 38 |  |         /// <param name="words">List of words in the text line.</param> | 
|  |  | 39 |  |         /// <param name="language">The BCP-47 language code of the recognized | 
|  |  | 40 |  |         /// text line. Only provided where the language of the line differs | 
|  |  | 41 |  |         /// from the page's.</param> | 
|  | 0 | 42 |  |         public Line(IList<double?> boundingBox, string text, IList<Word> words, string language = default(string)) | 
|  |  | 43 |  |         { | 
|  | 0 | 44 |  |             Language = language; | 
|  | 0 | 45 |  |             BoundingBox = boundingBox; | 
|  | 0 | 46 |  |             Text = text; | 
|  | 0 | 47 |  |             Words = words; | 
|  |  | 48 |  |             CustomInit(); | 
|  | 0 | 49 |  |         } | 
|  |  | 50 |  |  | 
|  |  | 51 |  |         /// <summary> | 
|  |  | 52 |  |         /// An initialization method that performs custom operations like setting defaults | 
|  |  | 53 |  |         /// </summary> | 
|  |  | 54 |  |         partial void CustomInit(); | 
|  |  | 55 |  |  | 
|  |  | 56 |  |         /// <summary> | 
|  |  | 57 |  |         /// Gets or sets the BCP-47 language code of the recognized text line. | 
|  |  | 58 |  |         /// Only provided where the language of the line differs from the | 
|  |  | 59 |  |         /// page's. | 
|  |  | 60 |  |         /// </summary> | 
|  |  | 61 |  |         [JsonProperty(PropertyName = "language")] | 
|  | 0 | 62 |  |         public string Language { get; set; } | 
|  |  | 63 |  |  | 
|  |  | 64 |  |         /// <summary> | 
|  |  | 65 |  |         /// Gets or sets bounding box of a recognized line. | 
|  |  | 66 |  |         /// </summary> | 
|  |  | 67 |  |         [JsonProperty(PropertyName = "boundingBox")] | 
|  | 0 | 68 |  |         public IList<double?> BoundingBox { get; set; } | 
|  |  | 69 |  |  | 
|  |  | 70 |  |         /// <summary> | 
|  |  | 71 |  |         /// Gets or sets the text content of the line. | 
|  |  | 72 |  |         /// </summary> | 
|  |  | 73 |  |         [JsonProperty(PropertyName = "text")] | 
|  | 0 | 74 |  |         public string Text { get; set; } | 
|  |  | 75 |  |  | 
|  |  | 76 |  |         /// <summary> | 
|  |  | 77 |  |         /// Gets or sets list of words in the text line. | 
|  |  | 78 |  |         /// </summary> | 
|  |  | 79 |  |         [JsonProperty(PropertyName = "words")] | 
|  | 0 | 80 |  |         public IList<Word> Words { get; set; } | 
|  |  | 81 |  |  | 
|  |  | 82 |  |         /// <summary> | 
|  |  | 83 |  |         /// Validate the object. | 
|  |  | 84 |  |         /// </summary> | 
|  |  | 85 |  |         /// <exception cref="ValidationException"> | 
|  |  | 86 |  |         /// Thrown if validation fails | 
|  |  | 87 |  |         /// </exception> | 
|  |  | 88 |  |         public virtual void Validate() | 
|  |  | 89 |  |         { | 
|  | 0 | 90 |  |             if (BoundingBox == null) | 
|  |  | 91 |  |             { | 
|  | 0 | 92 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "BoundingBox"); | 
|  |  | 93 |  |             } | 
|  | 0 | 94 |  |             if (Text == null) | 
|  |  | 95 |  |             { | 
|  | 0 | 96 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "Text"); | 
|  |  | 97 |  |             } | 
|  | 0 | 98 |  |             if (Words == null) | 
|  |  | 99 |  |             { | 
|  | 0 | 100 |  |                 throw new ValidationException(ValidationRules.CannotBeNull, "Words"); | 
|  |  | 101 |  |             } | 
|  | 0 | 102 |  |             if (Words != null) | 
|  |  | 103 |  |             { | 
|  | 0 | 104 |  |                 foreach (var element in Words) | 
|  |  | 105 |  |                 { | 
|  | 0 | 106 |  |                     if (element != null) | 
|  |  | 107 |  |                     { | 
|  | 0 | 108 |  |                         element.Validate(); | 
|  |  | 109 |  |                     } | 
|  |  | 110 |  |                 } | 
|  |  | 111 |  |             } | 
|  | 0 | 112 |  |         } | 
|  |  | 113 |  |     } | 
|  |  | 114 |  | } |