/* 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 DiscoveredAssetManagementGroup : IJsonOnDeserialized, IJsonOnSerializing
    {
        /// <summary>
        /// Array of actions that are part of the management group. Each action can have an individual configuration.
        /// </summary>
        [JsonPropertyName("actions")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public List<DiscoveredAssetManagementGroupAction>? Actions { get; set; } = default;

        /// <summary>
        /// Reference to a data source for a given management group.
        /// </summary>
        [JsonPropertyName("dataSource")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? DataSource { get; set; } = default;

        /// <summary>
        /// Default response timeout for all actions that are part of the management group.
        /// </summary>
        [JsonPropertyName("defaultTimeoutInSeconds")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public ulong? DefaultTimeoutInSeconds { get; set; } = default;

        /// <summary>
        /// Default MQTT topic path on which a client will receive the request for all actions that are part of the management group.
        /// </summary>
        [JsonPropertyName("defaultTopic")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? DefaultTopic { get; set; } = default;

        /// <summary>
        /// Timestamp (in UTC) indicating when the management group was added or modified.
        /// </summary>
        [JsonPropertyName("lastUpdatedOn")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public DateTime? LastUpdatedOn { get; set; } = default;

        /// <summary>
        /// Stringified JSON that contains connector-specific configuration for the management group.
        /// </summary>
        [JsonPropertyName("managementGroupConfiguration")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? ManagementGroupConfiguration { get; set; } = default;

        /// <summary>
        /// Name of the management group.
        /// </summary>
        [JsonPropertyName("name")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string Name { get; set; } = default!;

        /// <summary>
        /// URI or type definition ID.
        /// </summary>
        [JsonPropertyName("typeRef")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? TypeRef { get; set; } = default;

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

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