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

namespace Framework.StatSystem
{
    /// <summary>
    /// Acts as a general store of stat identifiers so that stats can be easily selected. 
    /// Other partial implementations of this class in this namespace should be made 
    /// in different parts of the project to add new stats to the system.
    /// </summary>
    public static partial class StatType
    {
        public static readonly Id Example = Allocate(); // Example Attribute, setup others by making other partial versions of this class

        // TODO, Use string to hashed value rather than a number perhaps? Problems with multiplayer could occur if number allocation is not the same on all clients
        private static int id; // The current id number, incremented every time an id is allocated

        /// <summary>
        /// Call this method when setting up a new stat id, it will return
        /// a unique id number for that stat
        /// </summary>
        /// <returns></returns>
        private static Id Allocate()
        {
            //return (Id)id++;
            return new Id(id++);
        }

        /// <summary>
        /// Stat ids use an inner class that defines how the id works,
        /// this is so that only stat ids can be used to identify stats.
        /// </summary>
        public struct Id
        {
            private int value;

            internal Id(int value)
            {
                this.value = value;
            }

            public override string ToString()
            {
                return "" + value;
            }
        }
    }

    // Example partial implementation
    //public static partial class Attributes
    //{
    //    public static readonly int Strength = Allocate();
    //}
}
