using System;

namespace ZB.MOM.WW.LmxProxy.Client.Domain;

/// <summary>
/// Represents the connection state of an LmxProxy client.
/// </summary>
public enum ConnectionState
{
	/// <summary>Not connected to the server.</summary>
	Disconnected,

	/// <summary>Connection attempt in progress.</summary>
	Connecting,

	/// <summary>Connected and ready for operations.</summary>
	Connected,

	/// <summary>Graceful disconnect in progress.</summary>
	Disconnecting,

	/// <summary>Connection failed with an error.</summary>
	Error,

	/// <summary>Attempting to re-establish a lost connection.</summary>
	Reconnecting
}

/// <summary>
/// Event arguments for connection state change notifications.
/// </summary>
public class ConnectionStateChangedEventArgs : EventArgs
{
	/// <summary>The previous connection state.</summary>
	public ConnectionState OldState { get; }

	/// <summary>The new connection state.</summary>
	public ConnectionState NewState { get; }

	/// <summary>Optional message describing the state change (e.g., error details).</summary>
	public string? Message { get; }

	public ConnectionStateChangedEventArgs(ConnectionState oldState, ConnectionState newState, string? message = null)
	{
		OldState = oldState;
		NewState = newState;
		Message = message;
	}
}
