namespace Grand.Business.Core.Utilities.ExportImport;

/// <summary>
///     A helper class to access the property by name
/// </summary>
/// <typeparam name="T">Object type</typeparam>
public class PropertyByName<T>
{
    /// <summary>
    ///     Ctor
    /// </summary>
    /// <param name="propertyName">Property name</param>
    /// <param name="func">Feature property access</param>
    public PropertyByName(string propertyName, Func<T, object> func = null)
    {
        PropertyName = propertyName;
        GetProperty = func;

        PropertyOrderPosition = 0;
    }

    /// <summary>
    ///     Property order position
    /// </summary>
    public int PropertyOrderPosition { get; set; }

    /// <summary>
    ///     Feature property access
    /// </summary>
    public Func<T, object> GetProperty { get; private set; }

    /// <summary>
    ///     Property name
    /// </summary>
    public string PropertyName { get; private set; }

    /// <summary>
    ///     Property value
    /// </summary>
    public object PropertyValue { get; set; }
}