/* 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 DiscoveredAssetManagementGroupAction : IJsonOnDeserialized, IJsonOnSerializing
    {
        /// <summary>
        /// Configuration for the action.
        /// </summary>
        [JsonPropertyName("actionConfiguration")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? ActionConfiguration { get; set; } = default;

        /// <summary>
        /// Type of the action.
        /// </summary>
        [JsonPropertyName("actionType")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public AssetManagementGroupActionType ActionType { get; set; } = default!;

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

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

        /// <summary>
        /// The target URI on which a client can invoke the specific action.
        /// </summary>
        [JsonPropertyName("targetUri")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string TargetUri { get; set; } = default!;

        /// <summary>
        /// Response timeout for the action.
        /// </summary>
        [JsonPropertyName("timeoutInSeconds")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public ulong? TimeoutInSeconds { get; set; } = default;

        /// <summary>
        /// The MQTT topic path on which a client will receive the request for the action.
        /// </summary>
        [JsonPropertyName("topic")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? Topic { 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");
            }
            if (TargetUri is null)
            {
                throw new ArgumentNullException("targetUri field cannot be null");
            }
        }

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