using Godot;
using SessionZero.SzfLib.Objects;
using System;
using System.Collections.Generic;
using System.Dynamic;

namespace SessionZeroApp;

public partial class DatasetsContentPage : ContentPageBase
{
    public override string PageName { get; protected set; } = "Datasets";

    [Export] private Button _backButton;
    [Export] private CustomListView _listView;

    public List<SzfDataset> Datasets { get; private set; } = [];

    

    public override void _Ready()
    {
        SetupConnections();

        Datasets.AddRange(LocalDatabaseHelper.GetAllDatasets());

        GD.Print(Datasets[0].GetMetadataField("Name"));
    }

    private void SetupConnections()
    {
        _backButton.Pressed += () => { AppManager.Instance.LoadPage("Library"); };
    }
}
