namespace ZB.MOM.WW.ScadaBridge.Commons.Entities.Deployment;

/// <summary>
/// Records a system-wide artifact deployment operation, tracking status per site.
/// </summary>
public class SystemArtifactDeploymentRecord
{
    /// <summary>Primary key.</summary>
    public int Id { get; set; }
    /// <summary>Type identifier for the deployed artifact (e.g. the artifact category name).</summary>
    public string ArtifactType { get; set; }
    /// <summary>Username of the operator who initiated the deployment.</summary>
    public string DeployedBy { get; set; }
    /// <summary>UTC timestamp when the deployment was initiated.</summary>
    public DateTimeOffset DeployedAt { get; set; }
    /// <summary>JSON-serialized per-site deployment status map, or null if not yet computed.</summary>
    public string? PerSiteStatus { get; set; }

    /// <summary>Initializes a new <see cref="SystemArtifactDeploymentRecord"/> with required fields.</summary>
    /// <param name="artifactType">The artifact type being deployed.</param>
    /// <param name="deployedBy">The username of the initiating operator.</param>
    public SystemArtifactDeploymentRecord(string artifactType, string deployedBy)
    {
        ArtifactType = artifactType ?? throw new ArgumentNullException(nameof(artifactType));
        DeployedBy = deployedBy ?? throw new ArgumentNullException(nameof(deployedBy));
    }
}
