| | 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.Personalizer.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 | | /// A counterfactual evaluation. |
| | 21 | | /// </summary> |
| | 22 | | public partial class EvaluationContract |
| | 23 | | { |
| | 24 | | /// <summary> |
| | 25 | | /// Initializes a new instance of the EvaluationContract class. |
| | 26 | | /// </summary> |
| 2 | 27 | | public EvaluationContract() |
| | 28 | | { |
| | 29 | | CustomInit(); |
| 2 | 30 | | } |
| | 31 | |
|
| | 32 | | /// <summary> |
| | 33 | | /// Initializes a new instance of the EvaluationContract class. |
| | 34 | | /// </summary> |
| | 35 | | /// <param name="name">The name of the evaluation.</param> |
| | 36 | | /// <param name="startTime">The start time of the evaluation.</param> |
| | 37 | | /// <param name="endTime">The end time of the evaluation.</param> |
| | 38 | | /// <param name="policies">Additional Learning settings to |
| | 39 | | /// evaluate.</param> |
| | 40 | | /// <param name="enableOfflineExperimentation">True if the evaluation |
| | 41 | | /// should explore for a more optimal Learning settings.</param> |
| 0 | 42 | | public EvaluationContract(string name, System.DateTime startTime, System.DateTime endTime, IList<PolicyContract> |
| | 43 | | { |
| 0 | 44 | | EnableOfflineExperimentation = enableOfflineExperimentation; |
| 0 | 45 | | Name = name; |
| 0 | 46 | | StartTime = startTime; |
| 0 | 47 | | EndTime = endTime; |
| 0 | 48 | | Policies = policies; |
| | 49 | | CustomInit(); |
| 0 | 50 | | } |
| | 51 | |
|
| | 52 | | /// <summary> |
| | 53 | | /// An initialization method that performs custom operations like setting defaults |
| | 54 | | /// </summary> |
| | 55 | | partial void CustomInit(); |
| | 56 | |
|
| | 57 | | /// <summary> |
| | 58 | | /// Gets or sets true if the evaluation should explore for a more |
| | 59 | | /// optimal Learning settings. |
| | 60 | | /// </summary> |
| | 61 | | [JsonProperty(PropertyName = "enableOfflineExperimentation")] |
| 4 | 62 | | public bool? EnableOfflineExperimentation { get; set; } |
| | 63 | |
|
| | 64 | | /// <summary> |
| | 65 | | /// Gets or sets the name of the evaluation. |
| | 66 | | /// </summary> |
| | 67 | | [JsonProperty(PropertyName = "name")] |
| 12 | 68 | | public string Name { get; set; } |
| | 69 | |
|
| | 70 | | /// <summary> |
| | 71 | | /// Gets or sets the start time of the evaluation. |
| | 72 | | /// </summary> |
| | 73 | | [JsonProperty(PropertyName = "startTime")] |
| 4 | 74 | | public System.DateTime StartTime { get; set; } |
| | 75 | |
|
| | 76 | | /// <summary> |
| | 77 | | /// Gets or sets the end time of the evaluation. |
| | 78 | | /// </summary> |
| | 79 | | [JsonProperty(PropertyName = "endTime")] |
| 4 | 80 | | public System.DateTime EndTime { get; set; } |
| | 81 | |
|
| | 82 | | /// <summary> |
| | 83 | | /// Gets or sets additional Learning settings to evaluate. |
| | 84 | | /// </summary> |
| | 85 | | [JsonProperty(PropertyName = "policies")] |
| 10 | 86 | | public IList<PolicyContract> Policies { get; set; } |
| | 87 | |
|
| | 88 | | /// <summary> |
| | 89 | | /// Validate the object. |
| | 90 | | /// </summary> |
| | 91 | | /// <exception cref="ValidationException"> |
| | 92 | | /// Thrown if validation fails |
| | 93 | | /// </exception> |
| | 94 | | public virtual void Validate() |
| | 95 | | { |
| 2 | 96 | | if (Name == null) |
| | 97 | | { |
| 0 | 98 | | throw new ValidationException(ValidationRules.CannotBeNull, "Name"); |
| | 99 | | } |
| 2 | 100 | | if (Policies == null) |
| | 101 | | { |
| 0 | 102 | | throw new ValidationException(ValidationRules.CannotBeNull, "Policies"); |
| | 103 | | } |
| 2 | 104 | | if (Name != null) |
| | 105 | | { |
| 2 | 106 | | if (Name.Length > 256) |
| | 107 | | { |
| 0 | 108 | | throw new ValidationException(ValidationRules.MaxLength, "Name", 256); |
| | 109 | | } |
| | 110 | | } |
| 2 | 111 | | if (Policies != null) |
| | 112 | | { |
| 8 | 113 | | foreach (var element in Policies) |
| | 114 | | { |
| 2 | 115 | | if (element != null) |
| | 116 | | { |
| 2 | 117 | | element.Validate(); |
| | 118 | | } |
| | 119 | | } |
| | 120 | | } |
| 2 | 121 | | } |
| | 122 | | } |
| | 123 | | } |