using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
using AipGateway.AIP;

namespace AipGateway.Test
{
    class Program
    {
        private static FileAipManager _aipManager;

        private static string email = ConfigurationManager.AppSettings["ida:EMail"];
        private static string tenantId = ConfigurationManager.AppSettings["ida:TenantId"];
        private static string clientId = ConfigurationManager.AppSettings["ida:ClientId"];
        private static string clientSecret = ConfigurationManager.AppSettings["ida:ClientSecret"];
        private static string mipData = ConfigurationManager.AppSettings["MipData"];
        private static string applicationName = ConfigurationManager.AppSettings["ApplicationName"];
        private static string applicationVersion = ConfigurationManager.AppSettings["ApplicationVersion"];

        static void Main(string[] args)
        {
            _aipManager = new FileAipManager(clientId, applicationName, applicationVersion, tenantId, clientSecret, mipData, email, ClaimsPrincipal.Current);

            List<AipLabel> aipLabels = _aipManager.ListAllLabels();
            foreach (var label in aipLabels)
            {
                Console.WriteLine(string.Format("ID: {0}, NAME: {1}", label.Id, label.Name));

                if (label.Children.Count > 0)
                {
                    foreach (AipLabel child in label.Children)
                    {
                        Console.WriteLine(string.Format("\tID: {0}, NAME: {1}", child.Id, child.Name));
                    }
                }
            }
            Console.ReadKey();
        }
    }
}
