using System;
using System.Collections.Generic;
using System.DirectoryServices.Linq;
using System.DirectoryServices.Linq.EntryObjects;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GreenTree.Nachtragsmanagement.Core.Authentication
{
    public class ActiveDirectoryContext : DirectoryContext
    {
        #region Properties

        /// <summary>
        /// Entry set for all users
        /// </summary>
        public IEntrySet<ActiveDirectoryUser> Users { get; set; }

        /// <summary>
        /// Entry set for all groups
        /// </summary>
        public IEntrySet<ActiveDirectoryGroup> Groups { get; set; }

        #endregion

        #region Ctor

        /// <summary>
        /// Initializes a new instance of ActiveDirectoryContext class
        /// </summary>
        public ActiveDirectoryContext()
        {

        }

        /// <summary>
        /// Initializes a new instance of ActiveDirectoryContext class
        /// </summary>
        public ActiveDirectoryContext(string connectionString, string userName, string password) 
            : base(connectionString, userName, password)
        {
            Users = CreateEntrySet<ActiveDirectoryUser>();
            Groups = CreateEntrySet<ActiveDirectoryGroup>();
        }

        #endregion
    }
}
