using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CzokoŚmieciarka.MonoGameView.DataModels.Exceptions;
using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans;
using CzokoŚmieciarka.MonoGameView.DataModels.Models;
using Microsoft.Xna.Framework.Content;

namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector
{
    public abstract class AGarbageCollector : IGarbageCollector, ICloneable
    {
        public AGarbageCollector(Coords startPosition, IEnumerable<AGarbageCollectorContainer> trashContainers, int columns, int rows)
        {
            this.columns = columns;
            this.rows = rows;
            this.Coords = startPosition;
            this.TrashContainers = trashContainers;
        }
        public Coords Coords { get; set; }
        public int columns { get; set; }
        public int rows { get; set; }
        public void MoveUp()
        {
            if(Coords.Y -1 < 0)
            {
                throw new OutOfGridException();
            }
            Coords.Y -= 1;
        }

        public void MoveDown()
        {
            if (Coords.Y + 1 >= rows)
            {
                throw new OutOfGridException();
            }
            Coords.Y +=1;
        }

        public void MoveLeft()
        {
            if (Coords.X - 1 < 0)
            {
                throw new OutOfGridException();
            }
            Coords.X -= 1;
        }

        public void MoveRight()
        {
            if (Coords.X + 1 >= columns)
            {
                throw new OutOfGridException();
            }
            Coords.X += 1;
        }

        public virtual object Clone(ContentManager content)
        {
            throw new NotImplementedException();
        }

        public IEnumerable<AGarbageCollectorContainer> TrashContainers { get; }
        public object Clone()
        {
            throw new NotImplementedException();
        }
    }
}