using System;

namespace CareFusion.Lib.StorageSystem.Attributes
{
    /// <summary>
    /// Attribute to declare that a classe's property can be selected by user to be included or not on serialization
    /// </summary>
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
    public class UserSelectablePropertyAttribute : Attribute
    {
        /// <summary>
        /// Gets or sets a value indicating whether this instance is mandatory.
        /// For a mandatory property, user cannot exclude it from a response. Only overwite its value
        /// </summary>
        public bool IsMandatory { get; set; }

        /// <summary>
        /// Value indicating the type of the property.
        /// This is used during initial set up of ITSystemSimulator to override the property's value
        /// </summary>
        public Type PropertyType { get; set; }

        public UserSelectablePropertyAttribute()
        {
            this.PropertyType = typeof(string);
        }

        public UserSelectablePropertyAttribute(Type propertyType)
        {
            this.PropertyType = propertyType;
        }

        public UserSelectablePropertyAttribute(bool isMandatory, Type propertyType)
        {        
            this.IsMandatory = isMandatory;
            this.PropertyType = propertyType;
        }
    }
}