using System.ComponentModel.DataAnnotations;

namespace Extrudex.API.DTOs.Materials;

/// <summary>
/// Response DTO for MaterialBase entity.
/// </summary>
public class MaterialBaseResponse
{
    /// <summary>Unique identifier for the material base.</summary>
    public Guid Id { get; set; }

    /// <summary>Human-readable name (e.g., "PLA", "PETG", "ABS").</summary>
    public string Name { get; set; } = string.Empty;

    /// <summary>Density in g/cm³ used for grams-derived calculations.</summary>
    public decimal DensityGperCm3 { get; set; }

    /// <summary>Timestamp when this record was created (UTC).</summary>
    public DateTime CreatedAt { get; set; }

    /// <summary>Timestamp when this record was last updated (UTC).</summary>
    public DateTime UpdatedAt { get; set; }
}

/// <summary>
/// Request DTO for creating a new MaterialBase.
/// </summary>
public class CreateMaterialBaseRequest
{
    /// <summary>Human-readable name (e.g., "PLA", "PETG", "ABS"). Required, max 50 characters.</summary>
    [Required(ErrorMessage = "Name is required.")]
    [StringLength(50, MinimumLength = 1, ErrorMessage = "Name must be between 1 and 50 characters.")]
    public string Name { get; set; } = string.Empty;

    /// <summary>Density in g/cm³. Must be greater than zero.</summary>
    [Required(ErrorMessage = "Density is required.")]
    [Range(0.001, 100.0, ErrorMessage = "Density must be between 0.001 and 100.0 g/cm³.")]
    public decimal DensityGperCm3 { get; set; }
}

/// <summary>
/// Request DTO for updating an existing MaterialBase.
/// </summary>
public class UpdateMaterialBaseRequest
{
    /// <summary>Human-readable name (e.g., "PLA", "PETG", "ABS"). Required, max 50 characters.</summary>
    [Required(ErrorMessage = "Name is required.")]
    [StringLength(50, MinimumLength = 1, ErrorMessage = "Name must be between 1 and 50 characters.")]
    public string Name { get; set; } = string.Empty;

    /// <summary>Density in g/cm³. Must be greater than zero.</summary>
    [Required(ErrorMessage = "Density is required.")]
    [Range(0.001, 100.0, ErrorMessage = "Density must be between 0.001 and 100.0 g/cm³.")]
    public decimal DensityGperCm3 { get; set; }
}