using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ImageBlockz.Api
{
    /// <summary>
    /// Operation Info links together operation and its control (if exists). It is also used to specify a path in Main Menu.
    /// </summary>
    public class OperationInfo
    {
        private Type operationType;
        private Type controlType;
        private string menuPath;

        /// <summary>
        /// Creates info about operation that will not be displayed in Main Menu and has no <see cref="OperationControl"/>, but can be used in user defined sequences.
        /// </summary>
        /// <param name="operationType">Type of operation class, eg. <c>typeof(Brightness)</c>.</param>
        public OperationInfo(Type operationType)
            : this(operationType, null, null)
        {

        }

        /// <summary>
        /// Creates info about operation that will be displayed in Main Menu but has no <see cref="OperationControl"/> and can be used in user defined sequences.
        /// </summary>
        /// <param name="operationType">Type of operation class, eg. <c>typeof(Brightness)</c>.</param>
        /// <param name="menuPath">Path to operation in Main Menu.</param>
        public OperationInfo(Type operationType, string menuPath)
            : this(operationType, menuPath, null)
        {

        }

        /// <summary>
        /// Creates info about operation that will be displayed in Main Menu, has <see cref="OperationControl"/> and can be used in user defined sequences.
        /// </summary>
        /// <param name="operationType">Type of operation class, eg. <c>typeof(Brightness)</c>.</param>
        /// <param name="menuPath">Path to operation in Main Menu.</param>
        /// <param name="controlType">Type of operation control class, eg. <c>typeof(BrightnessControl)</c>.</param>
        public OperationInfo(Type operationType, string menuPath, Type controlType)
        {
            if (operationType == null)
            {
                throw new ArgumentNullException("operationType");
            }

            this.operationType = operationType;
            this.controlType = controlType;
            this.menuPath = menuPath;
        }

        /// <summary>
        /// Gets <see cref="Type"/> of operation class.
        /// </summary>
        public Type OperationType
        {
            get
            {
                return operationType;
            }
        }

        /// <summary>
        /// Gets <see cref="Type"/> of operation control class.
        /// </summary>
        public Type ControlType
        {
            get
            {
                return controlType;
            }
        }


        /// <summary>
        /// Gets <see cref="string"/> name of operation class with full path.
        /// </summary>
        public string OperationId
        {
            get
            {
                return operationType.FullName;
            }
        }

        /// <summary>
        /// Gets <see cref="string"/> real path to operation in Main Menu.
        /// </summary>
        public string MenuPath
        {
            get
            {
                return menuPath;
            }
        }
    }
}
