using System.Collections.Generic;
using CommunityToolkit.Mvvm.DependencyInjection;
using PSCHelpdesk.Services;
using PSCHelpdesk.Shared.Service;
using PSCHelpdesk.Shared.ViewModels;

namespace PSCHelpdesk.ViewModels;

public partial class SettingsViewModel : ViewModelBase
{
    private List<SettingsTabItemViewModel> _tabItems;

    public List<SettingsTabItemViewModel> TabItems
    {
        get => _tabItems;
        set => SetAndRaisePropertyChanged(ref _tabItems, value);
    }


    public SettingsViewModel()
    {
        this.TabItems = new List<SettingsTabItemViewModel>();
        
        var settingsService = (SettingsService)Ioc.Default.GetService<ISettingsService>();
        foreach (var setting in settingsService.Settings)
        {
            TabItems.Add(new SettingsTabItemViewModel(setting.Header, setting.CommandParameter));
        }

    }


}