using System;
using System.Collections.Generic;
using System.Text;

namespace SokobanResultSearch
{
    public class State
    {
        #region Private fields

        /// <summary>
        /// String representation of the boxes positions in current state.
        /// </summary>
        private string  _boxesPositions;

        /// <summary>
        /// Directions of the players steps.
        /// </summary>
        private string  _directions;

        /// <summary>
        /// Player position in current state.
        /// </summary>
        private short   _playerPosition;

        /// <summary>
        /// Heuristics value of the current state.
        /// </summary>
        private int    _heuristicsValue;

        #endregion

        #region Constructors

        public State() { }

        public State(string boxesPositions, short playerPosition, string directions)
        {
            _boxesPositions     = boxesPositions;
            _playerPosition     = playerPosition;
            _directions         = directions;
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets boxes positions.
        /// </summary>
        public string BoxesPositions
        {
            get { return _boxesPositions; }
            set { _boxesPositions = value; }
        }

        /// <summary>
        /// Gets or sets directions of the players steps.
        /// </summary>
        public string Directions
        {
            get { return _directions; }
            set { _directions = value; }
        }

        /// <summary>
        /// Gets or sets player position.
        /// </summary>
        public short PlayerPosition
        {
            get { return _playerPosition; }
            set { _playerPosition = value; }
        }

        /// <summary>
        /// Gets or sets heuristics value of the current state.
        /// </summary>
        public int HeuristicsValue
        {
            get { return _heuristicsValue; }
            set { _heuristicsValue = value; }
        }

        #endregion

        #region Overrides

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        /// <summary>
        /// 
        /// </summary>
        public override string ToString()
        {
            if(_directions.Length > 0)
                return Properties.Resources.str_StepsCount + (_directions.Length / 2) + " " +
                    Properties.Resources.str_Steps + _directions.Substring(1) + Environment.NewLine;
            return base.ToString();
        }

        #endregion
    }
}
