using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace Models.Game
{

    /// <summary>
    /// The Position (x,y) of a cell in the game.
    /// </summary>
    public class Position : INotifyPropertyChanged
    {
        /// <summary>
        /// The X coordinate.
        /// </summary>
        public int X { get; set; }

        /// <summary>
        /// The Y coordinate.
        /// </summary>
        public int Y { get; set; }

        /// <summary>
        /// Constructor of the Position class.
        /// </summary>
        /// <param name="x">The X coordinate.</param>
        /// <param name="y">The Y coordinate.</param>
        public Position(int x, int y)
        {
            X = x;
            Y = y;
        }

        /// <summary>
        /// Event raised when a property is changed to notify the view.
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Trigger the PropertyChanged event for a specific property.
        /// </summary>
        /// <param name="propertyName">Name of the property that changed.</param>
        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}