namespace Extrudex.Domain.DTOs.Moonraker;

/// <summary>
/// Response DTO for a single Moonraker print job history item.
/// Maps to the objects returned by /server/history/items.
/// Contains filament usage, duration, and status for a completed or active print.
/// </summary>
public class MoonrakerPrintJob
{
    /// <summary>
    /// Unique Moonraker job identifier (e.g., "000001").
    /// </summary>
    public string JobId { get; set; } = string.Empty;

    /// <summary>
    /// Filename of the G-code file that was printed.
    /// </summary>
    public string Filename { get; set; } = string.Empty;

    /// <summary>
    /// Current status of this print job: "completed", "cancelled", "error", "in_progress".
    /// </summary>
    public string Status { get; set; } = string.Empty;

    /// <summary>
    /// Total filament used in millimeters for this print job.
    /// This is the primary measurement; grams are derived from this value.
    /// </summary>
    public decimal FilamentUsedMm { get; set; }

    /// <summary>
    /// Total print duration in seconds.
    /// </summary>
    public decimal PrintDurationSeconds { get; set; }

    /// <summary>
    /// Total print duration including setup and warmup, in seconds.
    /// </summary>
    public decimal TotalDurationSeconds { get; set; }

    /// <summary>
    /// Timestamp when the print job started (UTC).
    /// </summary>
    public DateTime? StartTime { get; set; }

    /// <summary>
    /// Timestamp when the print job ended (UTC). Null if still in progress.
    /// </summary>
    public DateTime? EndTime { get; set; }

    /// <summary>
    /// Metadata dictionary from Moonraker. May contain filament_type,
    /// filament_name, nozzle_diameter, and other slicer-provided fields.
    /// </summary>
    public Dictionary<string, object> Metadata { get; set; } = new();
}