// Copyright © WireMock.Net
using System.Security.Cryptography.X509Certificates;
using JetBrains.Annotations;
namespace WireMock.Settings;
///
/// If https is used, these settings can be used to configure the CertificateSettings in case a custom certificate instead the default .NET certificate should be used.
///
/// X509StoreName and X509StoreLocation should be defined
/// OR
/// X509CertificateFilePath should be defined
/// OR
/// X509Certificate should be defined
///
public class WireMockCertificateSettings
{
///
/// X.509 certificate StoreName (AddressBook, AuthRoot, CertificateAuthority, My, Root, TrustedPeople or TrustedPublisher)
///
[PublicAPI]
public string? X509StoreName { get; set; }
///
/// X.509 certificate StoreLocation (CurrentUser or LocalMachine)
///
[PublicAPI]
public string? X509StoreLocation { get; set; }
///
/// X.509 certificate Thumbprint or SubjectName (if not defined, the 'host' is used)
///
[PublicAPI]
public string? X509StoreThumbprintOrSubjectName { get; set; }
///
/// X.509 certificate FilePath
///
[PublicAPI]
public string? X509CertificateFilePath { get; set; }
///
/// A X.509 certificate instance.
///
[PublicAPI]
public X509Certificate2? X509Certificate { get; set; }
///
/// X.509 certificate Password
///
[PublicAPI]
public string? X509CertificatePassword { get; set; }
///
/// X509StoreName and X509StoreLocation should be defined
/// OR
/// X509CertificateFilePath should be defined
/// OR
/// X509Certificate should be defined
///
[PublicAPI]
public bool IsDefined =>
!string.IsNullOrEmpty(X509StoreName) && !string.IsNullOrEmpty(X509StoreLocation) ||
!string.IsNullOrEmpty(X509CertificateFilePath) ||
X509Certificate != null;
}