namespace Avalonia.Controls.Generators
{
    /// <summary>
    /// Holds information about an item container generated by an 
    /// <see cref="IItemContainerGenerator"/>.
    /// </summary>
    public class ItemContainerInfo
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ItemContainerInfo"/> class.
        /// </summary>
        /// <param name="container">The container control.</param>
        /// <param name="item">The item that the container represents.</param>
        /// <param name="index">
        /// The index of the item in the <see cref="ItemsControl.Items"/> collection.
        /// </param>
        public ItemContainerInfo(IControl container, object item, int index)
        {
            ContainerControl = container;
            Item = item;
            Index = index;
        }

        /// <summary>
        /// Gets the container control.
        /// </summary>
        /// <remarks>
        /// This will be null if <see cref="Item"/> is null.
        /// </remarks>
        public IControl ContainerControl { get; }

        /// <summary>
        /// Gets the item that the container represents.
        /// </summary>
        public object Item { get; internal set; }

        /// <summary>
        /// Gets the index of the item in the <see cref="ItemsControl.Items"/> collection.
        /// </summary>
        public int Index { get; set; }
    }
}
