/*
© 2017 Altavant Technologies Inc.
Web: http://www.altavant.com
*/

namespace Altavant.Fusion.Graphics
{
	using System;

	public class Shade
	{
		private Color _color;
		private Point _offset;

		public Shade(Color color, Point offset)
		{
			if (color == null)
				throw new ArgumentNullException(nameof(color));

			if (offset == null)
				throw new ArgumentNullException(nameof(offset));

			_color = color;
			_offset = offset;
		}

		public Color Color
		{
			get
			{
				return _color;
			}
			set
			{
				if (value == null)
					throw new ArgumentNullException();

				_color = value;
			}
		}

		public Point Offset
		{
			get
			{
				return _offset;
			}
			set
			{
				if (value == null)
					throw new ArgumentNullException();

				_offset = value;
			}
		}

		public override int GetHashCode()
		{
			return _color.GetHashCode() ^ _offset.GetHashCode();
		}

		public override bool Equals(object obj)
		{
			if (obj == null)
				return false;

			if (obj == this)
				return true;

			if (obj is Shade)
			{
				Shade shade = (Shade)obj;

				if (_color.Equals(shade.Color) && _offset.Equals(shade.Offset))
					return true;
			}

			return false;
		}

		public Shade Clone()
		{
			return new Shade(_color, _offset);
		}
	}
}