using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Kotor.DevelopmentKit.Base.Common;
using Kotor.DevelopmentKit.EditorGFF.Models;
using Kotor.DevelopmentKit.EditorGFF.ReactiveObjects;
using Kotor.DevelopmentKit.EditorGFF.ViewModels;

namespace Kotor.DevelopmentKit.EditorGFF.Actions;

public class SetInt16Action : BaseSetNodeAction<Int16GFFNode, Int16?>
{
    public SetInt16Action(NodePath path, Int16? oldValue, Int16? newValue)
        : base(path, oldValue, newValue)
    {
    }

    protected override Int16GFFNode InstantiateNode(IGFFNode parentNode, Int16? value)
        => new Int16GFFNode(parentNode, Path.Tail, value.Value);

    protected override void SetNewValue(Int16GFFNode node)
        => node.FieldValue = NewValue!.Value;

    protected override void SetOldValue(Int16GFFNode node)
        => node.FieldValue = OldValue!.Value;
}
