/* 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 x509 certificate for authentication mode Certificate.
    /// </summary>
    [System.CodeDom.Compiler.GeneratedCode("Azure.Iot.Operations.ProtocolCompilerLib", "1.0.0.0")]
    public partial class X509credentialsSchema : IJsonOnDeserialized, IJsonOnSerializing
    {
        /// <summary>
        /// The name of the secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx).
        /// </summary>
        [JsonPropertyName("certificateSecretName")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string CertificateSecretName { get; set; } = default!;

        /// <summary>
        /// A reference to the secret containing the combined intermediate certificates in PEM format.
        /// </summary>
        [JsonPropertyName("intermediateCertificatesSecretName")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? IntermediateCertificatesSecretName { get; set; } = default;

        /// <summary>
        /// A reference to the secret containing the certificate private key in PEM or DER format.
        /// </summary>
        [JsonPropertyName("keySecretName")]
        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
        public string? KeySecretName { get; set; } = default;

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

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