using Demo_Project.Shape;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telerik.WinControls.UI;

namespace Demo_Project.Model
{
    public class SpotModel : BaseModel
    {
        public string Name { get; set; }
        public ShelveModel Shelve => DistributionHallManager.GetShelveForSpot(this);
        public int Position { get; set; }
        public override void Draw()
        {
            Shape = new RadDiagramShape()
            {
                ElementShape = new SpotShape(),
                BackColor = Color.Orange,
                BorderBrush = new SolidBrush(Color.Black),
                DrawBorder = true,
                Tag = this,
                IsRotationEnabled = false,
                IsEditable = false,
                IsConnectorsManipulationEnabled = false,
                ZIndex = 1,
                Width = SpotShape.Width,
                Height = SpotShape.Height,
                Opacity = 0.3,
            };
            setPosition();
            Diagram.AddShape(Shape);
        }

        private void setPosition()
        {
            Shape.Position = new Point(Shelve.Position.X + (Position - 1) * (SpotShape.Width + SpotShape.WidthGap), Shelve.Position.Y - (SpotShape.Height / 2) + (ShelveShape.Height / 2));
        }

        public override void ReDraw()
        {
            setPosition();
        }

        public override void Remove()
        {
            throw new NotImplementedException();
        }

        public override void SaveChanges()
        {
            throw new NotImplementedException();
        }
    }
}
