using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DataOrganizer
{
    public partial class FileViewer : Form
    {
        private List<DB.Profile> Profiles { get; } = new List<DB.Profile>();

        public FileViewer()
        {
            InitializeComponent();
            var db = new DB();

            Profiles = db.GetProfiles();

            foreach(var profile in Profiles)
            {
                ProfileComboBox.Items.Add(profile.Name);
            }

            ProfileComboBox.SelectedIndexChanged += ProfileComboBox_SelectedIndexChanged;

            ProfileComboBox.SelectedIndex = 0;
        }

        private void ProfileComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            var profile = Profiles[ProfileComboBox.SelectedIndex];

            RootFolderComboBox.Items.Clear();

            if (profile.FolderGroups.Count > 0)
            {
                foreach (var folder in profile.FolderGroups)
                {
                    RootFolderComboBox.Items.Add(folder.Name);
                }

                RootFolderComboBox.SelectedIndex = 0;
            }

            RootFolderComboBox.Enabled = true;
        }

        private void FolderSelectButton_Click(object sender, EventArgs e)
        {
            
        }
    }
}
