namespace JLGames.RocketDriver.Editor.Infra
{
    /// <summary>
    /// Assets are composed primarily of data elements called fields. This class represents a 
    /// field, which is a \<title, value, type\> tuple such as \<Name, Fred, Text\>. This class 
    /// also contains several static utility functions to work with fields.
    /// </summary>
    [System.Serializable]
    public class Field
    {
        /// <summary>
        /// The title of the field, such as Name or Age.
        /// </summary>
        public string Title = null;

        /// <summary>
        /// The data type of the field, such as Text or Number.
        /// </summary>
        public FieldType Type = FieldType.Text;

        /// <summary>
        /// The value of the field, such as Fred or 42.
        /// </summary>
        public string Value = null;

        /// <summary>
        /// Initializes a new Field.
        /// </summary>
        public Field()
        {
        }

        /// <summary>
        /// Initializes a new Field.
        /// </summary>
        /// <param name='title'>
        /// Title of the field.
        /// </param>
        /// <param name='value'>
        /// Value of the field.
        /// </param>
        /// <param name='type'>
        /// Field type.
        /// </param>
        public Field(string title, FieldType type, string value)
        {
            Title = title;
            Type = type;
            Value = value;
        }

        /// <summary>
        /// Copy constructor.
        /// </summary>
        /// <param name="sourceField">Source field.</param>
        public Field(Field sourceField)
        {
            Title = sourceField.Title;
            Value = sourceField.Value;
            Type = sourceField.Type;
        }
    }
}