// ----------------------------------------------------------------------------------
// Microsoft Developer & Platform Evangelism
// 
// Copyright (c) Microsoft Corporation. All rights reserved.
// 
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES 
// OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
// ----------------------------------------------------------------------------------
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
// ----------------------------------------------------------------------------------

// Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Management.Automation;
using System.Management.Automation.Runspaces;

namespace Microsoft.Samples.CloudDrive
{
    #region PowerShell snap-in
    /// <summary>
    /// Create a PowerShell SnappIn description
    /// </summary>
    [RunInstaller(true)]
    public class CloudDrivePSSnapIn : CustomPSSnapIn
    {
        /// <summary>
        /// Get a name for this PowerShell snap-in. This name will be used in registering
        /// this PowerShell snap-in.
        /// </summary>
        public override string Name
        {
            get
            {
                return "CloudDriveSnapIn";
            }
        }

        /// <summary>
        /// Vendor information for this PowerShell snap-in.
        /// </summary>
        public override string Vendor
        {
            get
            {
                return "Microsoft";
            }
        }

        /// <summary>
        /// Gets resource information for vendor. This is a string of format: 
        /// resourceBaseName,resourceName. 
        /// </summary>
        public override string VendorResource
        {
            get
            {
                return String.Format("{0},{1}", Name, Vendor);
            }
        }

        /// <summary>
        /// Description of this PowerShell snap-in.
        /// </summary>
        public override string Description
        {
            get
            {
                return "This is a PowerShell snap-in that mounts Storage Service as a Drive Provider.";
            }
        }

        public override string DescriptionResource
        {
            get
            {
                return String.Format("{0},{1}",Name,Description);
            }
        }

        /// <summary>
        /// Specify the cmdlets that belong to this custom PowerShell snap-in.
        /// </summary>
        private Collection<CmdletConfigurationEntry> _cmdlets;
        public override Collection<CmdletConfigurationEntry> Cmdlets
        {
            get
            {
                if (_cmdlets == null)
                {
                    _cmdlets = new Collection<CmdletConfigurationEntry>();
                    _cmdlets.Add(new CmdletConfigurationEntry("copy-cd", typeof(CopyCDCommand), null));
                }

                return _cmdlets;
            }
        }

        /// <summary>
        /// Specify the providers that belong to this custom PowerShell snap-in.
        /// </summary>
        private Collection<ProviderConfigurationEntry> _providers;
        public override Collection<ProviderConfigurationEntry> Providers
        {
            get
            {
                if (_providers == null)
                {
                    _providers = new Collection<ProviderConfigurationEntry>();
                    _providers.Add(new ProviderConfigurationEntry("BlobDrive", typeof(BlobDriveProvider), null));
                    _providers.Add(new ProviderConfigurationEntry("QueueDrive", typeof(QueueDriveProvider), null));
                }

                return _providers;
            }
        }

        /// <summary>
        /// Specify the types that belong to this custom PowerShell snap-in.
        /// </summary>
        private Collection<TypeConfigurationEntry> _types;
        public override Collection<TypeConfigurationEntry> Types
        {
            get
            {
                if (_types == null)
                {
                    _types = new Collection<TypeConfigurationEntry>();
                    _types.Add(new TypeConfigurationEntry("CloudDrive.types.ps1xml"));
                }

                return _types;
            }
        }

        /// <summary>
        /// Specify the formats that belong to this custom PowerShell snap-in.
        /// </summary>
        private Collection<FormatConfigurationEntry> _formats;
        public override Collection<FormatConfigurationEntry> Formats
        {
            get
            {
                if (_formats == null)
                {
                    _formats = new Collection<FormatConfigurationEntry>();
                    _formats.Add(new FormatConfigurationEntry("CloudDrive.Format.ps1xml"));
                }

                return _formats;
            }
        }
    }

    #endregion PowerShell snap-in
}