/* 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.AssetAndDeviceRegistry.Generated.Common;

namespace Azure.Iot.Operations.Services.AssetAndDeviceRegistry.Generated.AdrBaseService
{
    /// <summary>
    /// The message schema reference object.
    /// </summary>
    [System.CodeDom.Compiler.GeneratedCode("Azure.Iot.Operations.ProtocolCompilerLib", "1.0.0.0")]
    public partial class MessageSchemaReference : IJsonOnDeserialized, IJsonOnSerializing
    {
        /// <summary>
        /// The reference to the message schema name.
        /// </summary>
        [JsonPropertyName("schemaName")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string SchemaName { get; set; } = default!;

        /// <summary>
        /// The reference to the message schema registry namespace.
        /// </summary>
        [JsonPropertyName("schemaRegistryNamespace")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string SchemaRegistryNamespace { get; set; } = default!;

        /// <summary>
        /// The reference to the message schema version.
        /// </summary>
        [JsonPropertyName("schemaVersion")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string SchemaVersion { get; set; } = default!;

        void IJsonOnDeserialized.OnDeserialized()
        {
            if (SchemaName is null)
            {
                throw new ArgumentNullException("schemaName field cannot be null");
            }
            if (SchemaRegistryNamespace is null)
            {
                throw new ArgumentNullException("schemaRegistryNamespace field cannot be null");
            }
            if (SchemaVersion is null)
            {
                throw new ArgumentNullException("schemaVersion field cannot be null");
            }
        }

        void IJsonOnSerializing.OnSerializing()
        {
            if (SchemaName is null)
            {
                throw new ArgumentNullException("schemaName field cannot be null");
            }
            if (SchemaRegistryNamespace is null)
            {
                throw new ArgumentNullException("schemaRegistryNamespace field cannot be null");
            }
            if (SchemaVersion is null)
            {
                throw new ArgumentNullException("schemaVersion field cannot be null");
            }
        }
    }
}
