//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Azure.Iot.Operations.Opc2WotLib {
    using System.Collections.Generic;
    using System.Linq;
    using System;
    
    
    public partial class WotDataSchemaEnum : WotDataSchema {
        
        public override string TransformText() {
 // Copyright (c) Microsoft Corporation. 
 // Licensed under the MIT License 
            this.Write("\"type\": \"object\",\r\n\"dov:typeRef\": \"");
            this.Write(this.ToStringHelper.ToStringWithCulture(this.typeRef));
            this.Write("\",\r\n\"const\": {\r\n");
 int ix1 = 1; foreach (KeyValuePair<string, OpcUaEnumValue> enumValue in this.enumValues) { 
            this.Write("  \"");
            this.Write(this.ToStringHelper.ToStringWithCulture(enumValue.Value.SymbolicName ?? enumValue.Key));
            this.Write("\": ");
            this.Write(this.ToStringHelper.ToStringWithCulture(enumValue.Value.Value));
            this.Write(this.ToStringHelper.ToStringWithCulture(ix1 < this.enumValues.Count ? "," : ""));
            this.Write("\r\n");
 ix1++; } 
            this.Write("},\r\n");
 if (this.description != null) { 
            this.Write("\"description\": \"");
            this.Write(this.ToStringHelper.ToStringWithCulture(this.description));
            this.Write("\",\r\n");
 } 
            this.Write("\"properties\": {\r\n");
 ix1 = 1; foreach (KeyValuePair<string, OpcUaEnumValue> enumValue in this.enumValues) { 
            this.Write("  \"");
            this.Write(this.ToStringHelper.ToStringWithCulture(enumValue.Value.SymbolicName ?? enumValue.Key));
            this.Write("\": {\r\n");
 if (enumValue.Value.Description != null) { 
            this.Write("    \"description\": \"");
            this.Write(this.ToStringHelper.ToStringWithCulture(enumValue.Value.Description));
            this.Write("\",\r\n");
 } 
            this.Write("    \"type\": \"integer\"\r\n  }");
            this.Write(this.ToStringHelper.ToStringWithCulture(ix1 < this.enumValues.Count ? "," : ""));
            this.Write("\r\n");
 ix1++; } 
            this.Write("}");
            return this.GenerationEnvironment.ToString();
        }
    }
}
