using System.Collections.Generic;
using Godot;
using Cthangover.Core.UI;
namespace Cthangover.Mods.Interface.Base.Lists
{
///
/// Generic list widget contract: binds a collection of models to Item widgets.
/// The two-step CreateModels() → CreateContent() pattern separates data sourcing
/// from instantiation, so subclasses can pull models from anywhere (runtime state,
/// config, save data) while the framework handles layout. ConstructUI/DestructUI
/// manage the full lifecycle of child items.
///
public interface IListWidget : IWidget
where TItem : class, IListItem
{
/// Padding between items in pixels, stored as Vector2(X, Y). The X component is horizontal gap, Y is vertical gap.
Vector2 ItemsCellPadding { get; }
/// The container Control that holds all child item nodes. Items are added as children of this node.
Control Content { get; }
/// The collection of instantiated item widgets. Populated by and cleared by .
List Items { get; set; }
/// Implementations return the collection of data models to display. Called once per cycle.
ICollection CreateModels();
/// Instantiates item widgets from the model collection. Separates model sourcing from instantiation so subclasses control both steps.
List CreateContent(ICollection models);
/// Calculates the total content size in pixels for items, used for scroll container sizing.
Vector2 GetContentSize(int count);
/// Builds the full item tree: creates models, instantiates items, and positions them via layout.
void ConstructUI();
/// Tears down all child items by calling each item's and clearing the Items list.
void DestructUI();
}
}