/* Code generated by Azure.Iot.Operations.ProtocolCompilerLib v1.0.0.0; DO NOT EDIT. */

#nullable enable

using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using Azure.Iot.Operations.Services.EdgeRegistry.Generated.Common;

namespace Azure.Iot.Operations.Services.EdgeRegistry.Generated
{
    /// <summary>
    /// A key-value pair used for labeling.
    /// </summary>
    [System.CodeDom.Compiler.GeneratedCode("Azure.Iot.Operations.ProtocolCompilerLib", "1.0.0.0")]
    public partial class Label : IJsonOnDeserialized, IJsonOnSerializing
    {
        [JsonPropertyName("key")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string Key { get; set; } = default!;

        [JsonPropertyName("value")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string Value { get; set; } = default!;

        void IJsonOnDeserialized.OnDeserialized()
        {
            if (Key is null)
            {
                throw new ArgumentNullException("key field cannot be null");
            }
            if (Value is null)
            {
                throw new ArgumentNullException("value field cannot be null");
            }
        }

        void IJsonOnSerializing.OnSerializing()
        {
            if (Key is null)
            {
                throw new ArgumentNullException("key field cannot be null");
            }
            if (Value is null)
            {
                throw new ArgumentNullException("value field cannot be null");
            }
        }
    }
}
