using Extrudex.Domain.Base;
using Extrudex.Domain.Enums;
namespace Extrudex.Domain.Entities;
///
/// Represents a 3D printer in the fleet. Stores connection details for
/// MQTT (Bambu Lab) or Moonraker (Elegoo Centauri Carbon) integration.
///
public class Printer : AuditableEntity
{
///
/// Current operational status of the printer, updated via real-time telemetry.
///
public PrinterStatus Status { get; set; } = PrinterStatus.Offline;
///
/// Human-readable name for the printer (e.g., "Bambu X1C #1", "Elegoo Centauri").
///
public string Name { get; set; } = string.Empty;
///
/// Manufacturer/brand of the printer (e.g., "Bambu Lab", "Elegoo").
///
public string Manufacturer { get; set; } = string.Empty;
///
/// Model name (e.g., "X1 Carbon", "Centauri Carbon").
///
public string Model { get; set; } = string.Empty;
///
/// The hardware type of the printer (FDM or Resin).
///
public PrinterType PrinterType { get; set; } = PrinterType.Fdm;
///
/// The connectivity protocol used by this printer (MQTT or Moonraker).
///
public ConnectionType ConnectionType { get; set; } = ConnectionType.Mqtt;
///
/// Hostname or IP address for connecting to the printer.
///
public string HostnameOrIp { get; set; } = string.Empty;
///
/// Port number for the printer connection. Defaults: 8883 (MQTT/TLS), 7125 (Moonraker).
///
public int Port { get; set; }
///
/// MQTT username for Bambu Lab printer authentication.
/// Stored only for MQTT connection type printers.
///
public string MqttUsername { get; set; } = string.Empty;
///
/// MQTT password for Bambu Lab printer authentication.
/// Stored only for MQTT connection type printers.
///
public string MqttPassword { get; set; } = string.Empty;
///
/// Whether to use TLS for the MQTT connection. Bambu Lab printers
/// require TLS on port 8883.
///
public bool MqttUseTls { get; set; }
///
/// Moonraker API key for Elegoo Centauri Carbon authentication.
/// Stored only for Moonraker connection type printers.
///
public string ApiKey { get; set; } = string.Empty;
///
/// Whether this printer is currently active and available for print jobs.
/// Inactive printers are retained for historical records.
///
public bool IsActive { get; set; } = true;
///
/// Timestamp of the last status update received from the printer (UTC).
/// Used to detect stale connections.
///
public DateTime? LastSeenAt { get; set; }
///
/// Navigation collection of AMS units installed on this printer.
///
public ICollection AmsUnits { get; set; } = new List();
///
/// Navigation collection of print jobs executed on this printer.
///
public ICollection PrintJobs { get; set; } = new List();
}