using ZB.MOM.WW.OtOpcUa.Client.Shared.Models;

namespace ZB.MOM.WW.OtOpcUa.Client.UI.Services;

/// <summary>
/// Persisted user connection settings.
/// </summary>
public sealed class UserSettings
{
    /// <summary>
    /// Gets or sets the last OPC UA endpoint URL entered by the user.
    /// </summary>
    public string EndpointUrl { get; set; } = "opc.tcp://localhost:4840";

    /// <summary>
    /// Gets or sets the persisted username for authenticated sessions.
    /// </summary>
    public string? Username { get; set; }

    /// <summary>
    /// Gets or sets the transport security mode selected by the user.
    /// </summary>
    public SecurityMode SecurityMode { get; set; } = SecurityMode.None;

    /// <summary>
    /// Gets or sets the raw failover endpoint list entered in the UI.
    /// </summary>
    public string? FailoverUrls { get; set; }

    /// <summary>
    /// Gets or sets the persisted session timeout, in seconds, for new client connections.
    /// </summary>
    public int SessionTimeoutSeconds { get; set; } = 60;

    /// <summary>
    /// Gets or sets a value indicating whether untrusted server certificates should be auto-accepted.
    /// </summary>
    public bool AutoAcceptCertificates { get; set; } = true;

    /// <summary>
    /// Gets or sets the certificate store path used for client certificates and trust lists.
    /// </summary>
    public string? CertificateStorePath { get; set; }

    /// <summary>
    /// Gets or sets the node IDs that should be re-subscribed when the UI reconnects.
    /// </summary>
    public List<string> SubscribedNodes { get; set; } = [];

    /// <summary>
    /// Gets or sets the alarm source node that should be restored when the UI reconnects.
    /// </summary>
    public string? AlarmSourceNodeId { get; set; }
}
