namespace ScadaLink.Commons.Entities.Deployment;

/// <summary>
/// WP-8: Stores the deployed configuration snapshot for an instance.
/// Captured at deploy time; compared against template-derived (live flattened) config for staleness detection.
/// </summary>
public class DeployedConfigSnapshot
{
    public int Id { get; set; }
    public int InstanceId { get; set; }
    public string DeploymentId { get; set; }
    public string RevisionHash { get; set; }

    /// <summary>
    /// JSON-serialized FlattenedConfiguration captured at deploy time.
    /// </summary>
    public string ConfigurationJson { get; set; }

    public DateTimeOffset DeployedAt { get; set; }

    public DeployedConfigSnapshot(string deploymentId, string revisionHash, string configurationJson)
    {
        DeploymentId = deploymentId ?? throw new ArgumentNullException(nameof(deploymentId));
        RevisionHash = revisionHash ?? throw new ArgumentNullException(nameof(revisionHash));
        ConfigurationJson = configurationJson ?? throw new ArgumentNullException(nameof(configurationJson));
    }
}
