using System;
using System.Collections.Generic;
using System.Text;
using AIStudio.Wpf.DiagramDesigner;
using AIStudio.Wpf.DiagramDesigner.Models;

namespace AIStudio.Wpf.SFC.ViewModels
{
    public class SFCActionNode : SFCNode
    {
        public SFCActionNode() : base(SFCNodeKinds.Action)
        {
            FontViewModel.FontSize = 10;
            ItemWidth = 60;
            ItemHeight = 48;

            ExecuteAddLeftInput(null);
        }

        public SFCActionNode(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
        {
            
        }

        public SFCActionNode(IDiagramViewModel root, SerializableItem serializableItem, string serializableType) : base(root, serializableItem, serializableType)
        {

        }

        private LinkPoint _linkPoint;
        public LinkPoint LinkPoint
        {
            get
            {
                return _linkPoint;
            }
            set
            {
                SetProperty(ref _linkPoint, value);
            }
        }

        protected override void ExecuteEditCommand(object parameter)
        {
            SFCActionNodeData data = new SFCActionNodeData(LinkPoint, Expression);
            if (visualiserService.ShowDialog(data) == true)
            {
                this.LinkPoint = data.LinkPoint;
                this.Expression = data.Expression;
            }
        }
    }
}
