/* 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 CreateOrUpdateDiscoveredAssetRequestSchema : IJsonOnDeserialized, IJsonOnSerializing
    {
        /// <summary>
        /// The discovered asset resource to create or update. Fields omitted in the request will be removed.
        /// </summary>
        [JsonPropertyName("discoveredAsset")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public DiscoveredAsset DiscoveredAsset { get; set; } = default!;

        /// <summary>
        /// The name of the discovered asset to create or update. This field is used to perform deduplication of discovered assets.
        /// </summary>
        [JsonPropertyName("discoveredAssetName")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string DiscoveredAssetName { get; set; } = default!;

        void IJsonOnDeserialized.OnDeserialized()
        {
            if (DiscoveredAsset is null)
            {
                throw new ArgumentNullException("discoveredAsset field cannot be null");
            }
            if (DiscoveredAssetName is null)
            {
                throw new ArgumentNullException("discoveredAssetName field cannot be null");
            }
        }

        void IJsonOnSerializing.OnSerializing()
        {
            if (DiscoveredAsset is null)
            {
                throw new ArgumentNullException("discoveredAsset field cannot be null");
            }
            if (DiscoveredAssetName is null)
            {
                throw new ArgumentNullException("discoveredAssetName field cannot be null");
            }
        }
    }
}
