using OpenNest.Geometry;
using System.Collections.Generic;

namespace OpenNest.Engine.Fill
{
    public class Pattern
    {
        public Pattern()
        {
            Parts = new List<Part>();
        }

        public List<Part> Parts { get; }

        public Box BoundingBox { get; private set; }

        public void UpdateBounds()
        {
            BoundingBox = Parts.GetBoundingBox();
        }

        public Pattern Clone(Vector offset)
        {
            var pattern = new Pattern();

            foreach (var part in Parts)
                pattern.Parts.Add(part.CloneAtOffset(offset));

            pattern.UpdateBounds();
            return pattern;
        }
    }
}
