using TraceCad.Core.Model;

namespace TraceCad.Core.Commands;

public sealed class UpdateConstraintCommand(
    SketchConstraint original,
    SketchConstraint replacement) : IDocumentCommand
{
    public string Name => "Update Constraint";

    public SketchConstraint Original { get; } = original;

    public SketchConstraint Replacement { get; } = replacement;

    public void Apply(SketchDocument document) => document.ReplaceConstraint(Replacement);

    public void Revert(SketchDocument document) => document.ReplaceConstraint(Original);
}
