using System;

namespace pdinklag.CPW.Common
{
    /// <summary>
    /// Attribute to tag instance scripts.
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    public class ScriptTargetAttribute : Attribute
    {
        /// <summary>
        /// The name of the entity this script targets.
        ///
        /// This may be null - then the name is the same as the tagged class.
        /// </summary>
        public string Target { get; private set; }

        /// <summary>
        /// Declares the script for an entity with the same name as the tagged class.
        /// </summary>
        public ScriptTargetAttribute()
        {
            Target = null;
        }

        /// <summary>
        /// Declares a script.
        /// </summary>
        /// <param name="target">the name of the entity this script targets, which must be in the same bundle</param>
        public ScriptTargetAttribute(string target)
        {
            Target = target;
        }
    }
}
