using System.ComponentModel.DataAnnotations;

namespace ASTRAIN.Shared.Models;

/// <summary>
/// Represents a single execution of a routine.
/// </summary>
public class RoutineRun
{
    /// <summary>
    /// Gets or sets the database identifier.
    /// </summary>
    public int Id { get; set; }

    /// <summary>
    /// Gets or sets the routine identifier.
    /// </summary>
    [Required]
    public int RoutineId { get; set; }

    /// <summary>
    /// Gets or sets the routine.
    /// </summary>
    public Routine? Routine { get; set; }

    /// <summary>
    /// Gets or sets the user identifier for this run.
    /// </summary>
    [Required]
    [MaxLength(8)]
    public string UserId { get; set; } = string.Empty;

    /// <summary>
    /// Gets or sets the run timestamp in UTC.
    /// </summary>
    public DateTime PerformedAt { get; set; } = DateTime.UtcNow;

    /// <summary>
    /// Gets or sets the entries completed during the run.
    /// </summary>
    public List<RoutineRunEntry> Entries { get; set; } = new();
}
