/* 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 AkriServiceError : IJsonOnDeserialized, IJsonOnSerializing
    {
        /// <summary>
        /// The error code that identifies the error.
        /// </summary>
        [JsonPropertyName("code")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public CodeSchema Code { get; set; } = default!;

        /// <summary>
        /// A human-readable description of the error.
        /// </summary>
        [JsonPropertyName("message")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string Message { get; set; } = default!;

        /// <summary>
        /// The timestamp (in UTC) when the error occurred.
        /// </summary>
        [JsonPropertyName("timestamp")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public DateTime Timestamp { get; set; } = default!;

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

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