<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MailSim.Common.Contracts;
using Microsoft.Azure.ActiveDirectory.GraphClient;
using Newtonsoft.Json.Linq;

namespace MailSim.ProvidersREST
{
    public class MailStoreProviderREST : IMailStore
    {
        private readonly ActiveDirectoryClient _adClient;
        private IMailFolder _rootFolder;

        private static IDictionary<string, string> _predefinedFolders = new Dictionary<string, string>
        {
            {"olFolderInbox", "Inbox"},
            {"olFolderDeletedItems", "Deleted Items"},
            {"olFolderDrafts", "Drafts"},
            {"olFolderJunk", "Junk Email"},
            {"olFolderOutbox", "Outbox"},
            {"olFolderSentMail", "Sent Items"},
        };

        public MailStoreProviderREST(string mailboxName)
        {
            _adClient = AuthenticationHelper.GetGraphClientAsync().Result;

            var user = Util.GetItemAsync<User>(string.Empty).Result;
            DisplayName = user.Id;
        }

        public IMailItem NewMailItem()
        {
            var body = new MailItemProvider.ItemBody
            {
                Content = "New Body",
                ContentType = "HTML"
            };

            var message = new MailItemProvider.Message
            {
                Subject = "New Subject",
                Body = body,
                ToRecipients = new List<MailItemProvider.Recipient>(),
                Importance = "High"
            };

            // Save the draft message. Saving to Me.Messages saves the message in the Drafts folder.<commit_msg>Attempt to clean-up<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MailSim.Common.Contracts;
using Microsoft.Azure.ActiveDirectory.GraphClient;
using Newtonsoft.Json.Linq;

namespace MailSim.ProvidersREST
{
    public class MailStoreProviderREST : IMailStore
    {
        private readonly ActiveDirectoryClient _adClient;
        private IMailFolder _rootFolder;

        private static IDictionary<string, string> _predefinedFolders = new Dictionary<string, string>
        {
            {"olFolderInbox",       "Inbox"},
            {"olFolderDeletedItems","Deleted Items"},
            {"olFolderDrafts",      "Drafts"},
            {"olFolderJunk",        "Junk Email"},
            {"olFolderOutbox",      "Outbox"},
            {"olFolderSentMail",    "Sent Items"},
        };

        public MailStoreProviderREST(string mailboxName)
        {
            _adClient = AuthenticationHelper.GetGraphClientAsync().Result;

            var user = Util.GetItemAsync<User>(string.Empty).Result;
            DisplayName = user.Id;
        }

        public IMailItem NewMailItem()
        {
            var body = new MailItemProvider.ItemBody
            {
                Content = "New Body",
                ContentType = "HTML"
            };

            var message = new MailItemProvider.Message
            {
                Subject = "New Subject",
                Body = body,
                ToRecipients = new List<MailItemProvider.Recipient>(),
                Importance = "High"
            };

            // Save the draft message. Saving to Me.Messages saves the message in the Drafts folder.
{'fraction_non_alphanumeric': 0.09042395493625853, 'fraction_numerical': 0.0, 'mean_word_length': 2.058930190389846, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5103284', 'n_tokens_mistral': 877, 'n_tokens_neox': 845, 'n_words': 204}