/* 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 AssetEventGroupSchemaElementSchema : IJsonOnDeserialized, IJsonOnSerializing
    {
        /// <summary>
        /// The address of the notifier of the event group in the asset (e.g. URL) so that a client can access the event group on the asset.
        /// </summary>
        [JsonPropertyName("dataSource")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? DataSource { get; set; } = default;

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

        /// <summary>
        /// Stringified JSON that contains connector-specific configuration for the event group. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize.
        /// </summary>
        [JsonPropertyName("eventGroupConfiguration")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? EventGroupConfiguration { get; set; } = default;

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

        /// <summary>
        /// Name of the event 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");
            }
        }
    }
}
