/* 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
{
    [System.CodeDom.Compiler.GeneratedCode("Azure.Iot.Operations.ProtocolCompilerLib", "1.0.0.0")]
    public partial class DeviceUpdateEventSchema : IJsonOnDeserialized, IJsonOnSerializing
    {
        /// <summary>
        /// The updated device resource, containing the specific inbound endpoint details as specified in the topic.
        /// </summary>
        [JsonPropertyName("device")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public Device Device { get; set; } = default!;

        /// <summary>
        /// The name of the device that was updated.
        /// </summary>
        [JsonPropertyName("deviceName")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string DeviceName { get; set; } = default!;

        void IJsonOnDeserialized.OnDeserialized()
        {
            if (Device is null)
            {
                throw new ArgumentNullException("device field cannot be null");
            }
            if (DeviceName is null)
            {
                throw new ArgumentNullException("deviceName field cannot be null");
            }
        }

        void IJsonOnSerializing.OnSerializing()
        {
            if (Device is null)
            {
                throw new ArgumentNullException("device field cannot be null");
            }
            if (DeviceName is null)
            {
                throw new ArgumentNullException("deviceName field cannot be null");
            }
        }
    }
}
