using System.Net;

namespace adas_core.Domain.Exceptions;

/// <summary>
/// Represents an exception that is thrown when an error occurs within the login services layer.
/// </summary>
/// <remarks>
/// This exception extends <see cref="BusinessException"/> to signal business-level failures
/// specific to authentication and login operations.
/// </remarks>
/// <!-- aidoc:v1 sig=354544f -->
public class LoginServicesException : BusinessException
{
    /// <summary>
    /// Initializes a new instance of the <see cref="LoginServicesException"/> class with a descriptive error message, forwarding it to the base exception together with an HTTP <see cref="HttpStatusCode.BadRequest"/> status code.
    /// </summary>
    /// <param name="message">The error message that describes the login service failure.</param>
    /// <!-- aidoc:v1 sig=16739ff body=4448e1d -->
    public LoginServicesException(string message) :
        base(HttpStatusCode.BadRequest, $"Login service error: {message}")
    {
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="LoginServicesException"/> class, which represents errors that occur in the login service. The supplied <paramref name="message"/> is prefixed with a service-context note and the underlying <paramref name="exception"/> is preserved as the inner exception.
    /// </summary>
    /// <param name="message">The error message describing the login service failure.</param>
    /// <param name="exception">The inner <see cref="System.Exception"/> that caused the current exception.</param>
    /// <!-- aidoc:v1 sig=83e8d73 body=4448e1d -->
    public LoginServicesException(string message, Exception exception) : base($"Login service error: {message}",
        exception)
    {
    }
}