/* 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 credentials for authentication mode UsernamePassword.
    /// </summary>
    [System.CodeDom.Compiler.GeneratedCode("Azure.Iot.Operations.ProtocolCompilerLib", "1.0.0.0")]
    public partial class UsernamePasswordCredentialsSchema : IJsonOnDeserialized, IJsonOnSerializing
    {
        /// <summary>
        /// The name of the secret containing the password.
        /// </summary>
        [JsonPropertyName("passwordSecretName")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string PasswordSecretName { get; set; } = default!;

        /// <summary>
        /// The name of the secret containing the username.
        /// </summary>
        [JsonPropertyName("usernameSecretName")]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonRequired]
        public string UsernameSecretName { get; set; } = default!;

        void IJsonOnDeserialized.OnDeserialized()
        {
            if (PasswordSecretName is null)
            {
                throw new ArgumentNullException("passwordSecretName field cannot be null");
            }
            if (UsernameSecretName is null)
            {
                throw new ArgumentNullException("usernameSecretName field cannot be null");
            }
        }

        void IJsonOnSerializing.OnSerializing()
        {
            if (PasswordSecretName is null)
            {
                throw new ArgumentNullException("passwordSecretName field cannot be null");
            }
            if (UsernameSecretName is null)
            {
                throw new ArgumentNullException("usernameSecretName field cannot be null");
            }
        }
    }
}
