All checks were successful
Dev Build / build-test (pull_request) Successful in 3m11s
115 lines
3.0 KiB
C#
115 lines
3.0 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace Extrudex.API.DTOs.UsageLogs;
|
|
|
|
/// <summary>
|
|
/// Request DTO for recording a filament usage entry.
|
|
/// </summary>
|
|
public class CreateUsageLogRequest
|
|
{
|
|
/// <summary>
|
|
/// The ID of the spool that provided the filament.
|
|
/// </summary>
|
|
[Required]
|
|
public Guid SpoolId { get; set; }
|
|
|
|
/// <summary>
|
|
/// The number of grams of filament consumed.
|
|
/// </summary>
|
|
[Required]
|
|
[Range(0.01, double.MaxValue, ErrorMessage = "GramsUsed must be a positive value.")]
|
|
public decimal GramsUsed { get; set; }
|
|
|
|
/// <summary>
|
|
/// The source of the usage data (Mqtt, Moonraker, Manual).
|
|
/// </summary>
|
|
[Required]
|
|
public string DataSource { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// The ID of the printer that consumed the filament. Optional.
|
|
/// </summary>
|
|
public Guid? PrinterId { get; set; }
|
|
|
|
/// <summary>
|
|
/// The ID of the print job associated with this usage. Optional.
|
|
/// </summary>
|
|
public Guid? PrintJobId { get; set; }
|
|
|
|
/// <summary>
|
|
/// The number of millimeters of filament extruded. Optional.
|
|
/// </summary>
|
|
public decimal? MmExtruded { get; set; }
|
|
|
|
/// <summary>
|
|
/// When the usage occurred (UTC). Defaults to now if not specified.
|
|
/// </summary>
|
|
public DateTime? UsageTimestamp { get; set; }
|
|
|
|
/// <summary>
|
|
/// Optional notes about this usage entry.
|
|
/// </summary>
|
|
[MaxLength(2000)]
|
|
public string? Notes { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Response DTO for a usage log entry.
|
|
/// </summary>
|
|
public class UsageLogResponse
|
|
{
|
|
/// <summary>
|
|
/// Unique identifier for the usage log entry.
|
|
/// </summary>
|
|
public Guid Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// The spool that provided the filament.
|
|
/// </summary>
|
|
public Guid SpoolId { get; set; }
|
|
|
|
/// <summary>
|
|
/// The printer that consumed the filament, if applicable.
|
|
/// </summary>
|
|
public Guid? PrinterId { get; set; }
|
|
|
|
/// <summary>
|
|
/// The print job associated with this usage, if applicable.
|
|
/// </summary>
|
|
public Guid? PrintJobId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Grams of filament consumed.
|
|
/// </summary>
|
|
public decimal GramsUsed { get; set; }
|
|
|
|
/// <summary>
|
|
/// Millimeters of filament extruded, if available.
|
|
/// </summary>
|
|
public decimal? MmExtruded { get; set; }
|
|
|
|
/// <summary>
|
|
/// When the usage occurred (UTC).
|
|
/// </summary>
|
|
public DateTime UsageTimestamp { get; set; }
|
|
|
|
/// <summary>
|
|
/// Source of the usage data (Mqtt, Moonraker, Manual).
|
|
/// </summary>
|
|
public string DataSource { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Optional notes about this usage entry.
|
|
/// </summary>
|
|
public string? Notes { get; set; }
|
|
|
|
/// <summary>
|
|
/// When the record was created (UTC).
|
|
/// </summary>
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
/// <summary>
|
|
/// When the record was last updated (UTC).
|
|
/// </summary>
|
|
public DateTime UpdatedAt { get; set; }
|
|
} |