using System;
using System.Xml.Serialization;
using System.Windows.Input;
using Earthblend.Tts.Common.Core.MeshGenerators.Base;
using Earthblend.DynamicCompile;
using Earthblend.Tts.Common.Core.Services;
using Earthblend.Nts.Common.MeshGenerators.Base;

namespace Earthblend.Tts.Common.Core.MeshGenerators
{
    public partial class SkewBoxMeshGenerator : MeshGeneratorBase
    {
        private ICommand _pairedMovementP1P2ZMinusCommandIc;[XmlIgnore] public ICommand PairedMovementP1P2ZMinusCommandIc => _pairedMovementP1P2ZMinusCommandIc ?? (_pairedMovementP1P2ZMinusCommandIc = new RelayCommand<Object>(PairedMovementP1P2ZMinusCommandIcExecuted));
        private ICommand _pairedMovementP1P2ZPlusCommandIc;[XmlIgnore] public ICommand PairedMovementP1P2ZPlusCommandIc => _pairedMovementP1P2ZPlusCommandIc ?? (_pairedMovementP1P2ZPlusCommandIc = new RelayCommand<Object>(PairedMovementP1P2ZPlusCommandIcExecuted));
        private ICommand _pairedMovementP3P4ZMinusCommandIc;[XmlIgnore] public ICommand PairedMovementP3P4ZMinusCommandIc => _pairedMovementP3P4ZMinusCommandIc ?? (_pairedMovementP3P4ZMinusCommandIc = new RelayCommand<Object>(PairedMovementP3P4ZMinusCommandIcExecuted));
        private ICommand _pairedMovementP3P4ZPlusCommandIc;[XmlIgnore] public ICommand PairedMovementP3P4ZPlusCommandIc => _pairedMovementP3P4ZPlusCommandIc ?? (_pairedMovementP3P4ZPlusCommandIc = new RelayCommand<Object>(PairedMovementP3P4ZPlusCommandIcExecuted));

        private ICommand _pairedMovementP5P6ZMinusCommandIc;[XmlIgnore] public ICommand PairedMovementP5P6ZMinusCommandIc => _pairedMovementP5P6ZMinusCommandIc ?? (_pairedMovementP5P6ZMinusCommandIc = new RelayCommand<Object>(PairedMovementP5P6ZMinusCommandIcExecuted));
        private ICommand _pairedMovementP5P6ZPlusCommandIc;[XmlIgnore] public ICommand PairedMovementP5P6ZPlusCommandIc => _pairedMovementP5P6ZPlusCommandIc ?? (_pairedMovementP5P6ZPlusCommandIc = new RelayCommand<Object>(PairedMovementP5P6ZPlusCommandIcExecuted));
        private ICommand _pairedMovementP7P8ZMinusCommandIc;[XmlIgnore] public ICommand PairedMovementP7P8ZMinusCommandIc => _pairedMovementP7P8ZMinusCommandIc ?? (_pairedMovementP7P8ZMinusCommandIc = new RelayCommand<Object>(PairedMovementP7P8ZMinusCommandIcExecuted));
        private ICommand _pairedMovementP7P8ZPlusCommandIc;[XmlIgnore] public ICommand PairedMovementP7P8ZPlusCommandIc => _pairedMovementP7P8ZPlusCommandIc ?? (_pairedMovementP7P8ZPlusCommandIc = new RelayCommand<Object>(PairedMovementP7P8ZPlusCommandIcExecuted));


        private ICommand _pairedMovementP1P8XMinusCommandIc;[XmlIgnore] public ICommand PairedMovementP1P8XMinusCommandIc => _pairedMovementP1P8XMinusCommandIc ?? (_pairedMovementP1P8XMinusCommandIc = new RelayCommand<Object>(PairedMovementP1P8ZMinusCommandIcExecuted));
        public void PairedMovementP1P8ZMinusCommandIcExecuted(Object sender) { SkewP1X -= MovementValue; SkewP8X -= MovementValue; RebuildMesh(); }
        public void PairedMovementP1P8ZPlusCommandIcExecuted(Object sender) { SkewP1X += MovementValue; SkewP8X += MovementValue; RebuildMesh(); }
        private ICommand _pairedMovementP1P8XPlusCommandIc;[XmlIgnore] public ICommand PairedMovementP1P8XPlusCommandIc => _pairedMovementP1P8XPlusCommandIc ?? (_pairedMovementP1P8XPlusCommandIc = new RelayCommand<Object>(PairedMovementP1P8ZPlusCommandIcExecuted));

        private ICommand _pairedMovementP2P7XMinusCommandIc;[XmlIgnore] public ICommand PairedMovementP2P7XMinusCommandIc => _pairedMovementP2P7XMinusCommandIc ?? (_pairedMovementP2P7XMinusCommandIc = new RelayCommand<Object>(PairedMovementP2P7ZMinusCommandIcExecuted));
        public void PairedMovementP2P7ZMinusCommandIcExecuted(Object sender) { SkewP2X -= MovementValue; SkewP7X -= MovementValue; RebuildMesh(); }
        public void PairedMovementP2P7ZPlusCommandIcExecuted(Object sender) { SkewP2X += MovementValue; SkewP7X += MovementValue; RebuildMesh(); }
        private ICommand _pairedMovementP2P7XPlusCommandIc;[XmlIgnore] public ICommand PairedMovementP2P7XPlusCommandIc => _pairedMovementP2P7XPlusCommandIc ?? (_pairedMovementP2P7XPlusCommandIc = new RelayCommand<Object>(PairedMovementP2P7ZPlusCommandIcExecuted));



        public void PairedMovementP1P2ZMinusCommandIcExecuted(Object sender) { SkewP1Z -= MovementValue; SkewP2Z -= MovementValue; RebuildMesh(); }
        public void PairedMovementP1P2ZPlusCommandIcExecuted(Object sender) { SkewP1Z += MovementValue; SkewP2Z += MovementValue; RebuildMesh(); }
        public void PairedMovementP3P4ZMinusCommandIcExecuted(Object sender) { SkewP3Z -= MovementValue; SkewP4Z -= MovementValue; RebuildMesh(); }
        public void PairedMovementP3P4ZPlusCommandIcExecuted(Object sender) { SkewP3Z += MovementValue; SkewP4Z += MovementValue; RebuildMesh(); }
        public void PairedMovementP5P6ZMinusCommandIcExecuted(Object sender) { SkewP5Z -= MovementValue; SkewP6Z -= MovementValue; RebuildMesh(); }
        public void PairedMovementP5P6ZPlusCommandIcExecuted(Object sender) { SkewP5Z += MovementValue; SkewP6Z += MovementValue; RebuildMesh(); }
        public void PairedMovementP7P8ZMinusCommandIcExecuted(Object sender) { SkewP7Z -= MovementValue; SkewP8Z -= MovementValue; RebuildMesh(); }
        public void PairedMovementP7P8ZPlusCommandIcExecuted(Object sender) { SkewP7Z += MovementValue; SkewP8Z += MovementValue; RebuildMesh(); }



        private ICommand _widthToHeightCommandIc;[XmlIgnore] public ICommand WidthToHeightCommandIc => _widthToHeightCommandIc ?? (_widthToHeightCommandIc = new RelayCommand<Object>(WidthToHeightCommandIcExecuted));

        public void WidthToHeightCommandIcExecuted(Object sender) { var temp = Width; Width = Height; Height = temp; RebuildMesh(); }

        private ICommand _depthToHeightCommandIc;[XmlIgnore] public ICommand DepthToHeightCommandIc => _depthToHeightCommandIc ?? (_depthToHeightCommandIc = new RelayCommand<Object>(DepthToHeightCommandIcExecuted));

        public void DepthToHeightCommandIcExecuted(Object sender) { var temp = Depth; Depth = Height; Height = temp; RebuildMesh(); }


        private ICommand _cycleValuesCommandIc;[XmlIgnore] public ICommand CycleValuesCommandIc => _cycleValuesCommandIc ?? (_cycleValuesCommandIc = new RelayCommand<Object>(CycleValuesCommandIcExecuted));

        public void CycleValuesCommandIcExecuted(Object sender) { var width = Width; Width = Height; Height = Depth; Depth = width; RebuildMesh(); }

        private ICommand _presetSizeCommandIc;[XmlIgnore] public ICommand PresetSizeCommandIc => _presetSizeCommandIc ?? (_presetSizeCommandIc = new RelayCommand<Object>(PresetSizeCommandIcExecuted));

        private void PresetSizeCommandIcExecuted(Object obj)
        {
            if (obj == null) return;
            var point3D = new PresetService().TranslateSize(obj.ToString());
            Width = point3D.X;
            Height = point3D.Y;
            Depth = point3D.Z;

            RebuildMesh();
        }
    }
}