/* 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 discovered asset resource to create or update. Fields omitted in the request will be removed.
    /// </summary>
    [System.CodeDom.Compiler.GeneratedCode("Azure.Iot.Operations.ProtocolCompilerLib", "1.0.0.0")]
    public partial class DiscoveredAsset : IJsonOnDeserialized, IJsonOnSerializing
    {
        /// <summary>
        /// URIs or type definition IDs for the asset type.
        /// </summary>
        [JsonPropertyName("assetTypeRefs")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public List<string>? AssetTypeRefs { get; set; } = default;

        /// <summary>
        /// A set of key-value pairs that contain custom attributes.
        /// </summary>
        [JsonPropertyName("attributes")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public Dictionary<string, string>? Attributes { get; set; } = default;

        /// <summary>
        /// Array of datasets that are part of the asset. Each data set spec describes the data points that make up the set.
        /// </summary>
        [JsonPropertyName("datasets")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public List<DiscoveredAssetDataset>? Datasets { get; set; } = default;

        /// <summary>
        /// Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here.
        /// </summary>
        [JsonPropertyName("defaultDatasetsConfiguration")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? DefaultDatasetsConfiguration { get; set; } = default;

        /// <summary>
        /// Default destinations for a dataset.
        /// </summary>
        [JsonPropertyName("defaultDatasetsDestinations")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public List<DatasetDestination>? DefaultDatasetsDestinations { get; set; } = default;

        /// <summary>
        /// Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here.
        /// </summary>
        [JsonPropertyName("defaultEventsConfiguration")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? DefaultEventsConfiguration { get; set; } = default;

        /// <summary>
        /// Default destinations for an event.
        /// </summary>
        [JsonPropertyName("defaultEventsDestinations")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public List<EventStreamDestination>? DefaultEventsDestinations { get; set; } = default;

        /// <summary>
        /// Stringified JSON that contains connector-specific default configuration for all management groups. Each management group can have its own configuration that overrides the default settings here.
        /// </summary>
        [JsonPropertyName("defaultManagementGroupsConfiguration")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? DefaultManagementGroupsConfiguration { get; set; } = default;

        /// <summary>
        /// Stringified JSON that contains connector-specific default configuration for all streams. Each stream can have its own configuration that overrides the default settings here.
        /// </summary>
        [JsonPropertyName("defaultStreamsConfiguration")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? DefaultStreamsConfiguration { get; set; } = default;

        /// <summary>
        /// Default destinations for a stream.
        /// </summary>
        [JsonPropertyName("defaultStreamsDestinations")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public List<EventStreamDestination>? DefaultStreamsDestinations { get; set; } = default;

        /// <summary>
        /// Human-readable description of the asset.
        /// </summary>
        [JsonPropertyName("description")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? Description { get; set; } = default;

        /// <summary>
        /// Reference to the device that provides data for this asset. Must provide device name & endpoint on the device to use.
        /// </summary>
        [JsonPropertyName("deviceRef")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public AssetDeviceRef DeviceRef { get; set; } = default!;

        /// <summary>
        /// Human-readable display name.
        /// </summary>
        [JsonPropertyName("displayName")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? DisplayName { get; set; } = default;

        /// <summary>
        /// Asset documentation reference.
        /// </summary>
        [JsonPropertyName("documentationUri")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? DocumentationUri { get; set; } = default;

        /// <summary>
        /// Array of event groups that are part of the asset. Each event group can have per-event group configuration.
        /// </summary>
        [JsonPropertyName("eventGroups")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public List<DiscoveredAssetEventGroup>? EventGroups { get; set; } = default;

        /// <summary>
        /// Asset ID provided by the customer.
        /// </summary>
        [JsonPropertyName("externalAssetId")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? ExternalAssetId { get; set; } = default;

        /// <summary>
        /// Asset hardware revision number.
        /// </summary>
        [JsonPropertyName("hardwareRevision")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? HardwareRevision { get; set; } = default;

        /// <summary>
        /// Array of management groups that are part of the asset. Each management group can have a per-group configuration.
        /// </summary>
        [JsonPropertyName("managementGroups")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public List<DiscoveredAssetManagementGroup>? ManagementGroups { get; set; } = default;

        /// <summary>
        /// Asset manufacturer.
        /// </summary>
        [JsonPropertyName("manufacturer")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? Manufacturer { get; set; } = default;

        /// <summary>
        /// Asset manufacturer URI.
        /// </summary>
        [JsonPropertyName("manufacturerUri")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? ManufacturerUri { get; set; } = default;

        /// <summary>
        /// Asset model.
        /// </summary>
        [JsonPropertyName("model")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? Model { get; set; } = default;

        /// <summary>
        /// Asset product code.
        /// </summary>
        [JsonPropertyName("productCode")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? ProductCode { get; set; } = default;

        /// <summary>
        /// Asset serial number.
        /// </summary>
        [JsonPropertyName("serialNumber")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? SerialNumber { get; set; } = default;

        /// <summary>
        /// Asset software revision number.
        /// </summary>
        [JsonPropertyName("softwareRevision")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? SoftwareRevision { get; set; } = default;

        /// <summary>
        /// Array of streams that are part of the asset. Each stream can have per-stream configuration.
        /// </summary>
        [JsonPropertyName("streams")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public List<DiscoveredAssetStream>? Streams { get; set; } = default;

        void IJsonOnDeserialized.OnDeserialized()
        {
            if (DeviceRef is null)
            {
                throw new ArgumentNullException("deviceRef field cannot be null");
            }
        }

        void IJsonOnSerializing.OnSerializing()
        {
            if (DeviceRef is null)
            {
                throw new ArgumentNullException("deviceRef field cannot be null");
            }
        }
    }
}
