using System.Collections.ObjectModel;
using MECF.Framework.Common.CommonData;
using MECF.Framework.UI.Client.CenterViews.Editors.Sequence;

namespace MECF.Framework.UI.Client.CenterViews.Editors
{
    public class ProcessTypeFileItem : NotifiableItem
    {
        #region Variablers

        private ObservableCollection<FileNode> _fileListByProcessType;

        #endregion

        #region Constructors

        public ProcessTypeFileItem()
        {
            FileListByProcessType = new ObservableCollection<FileNode>();
        }

        public ProcessTypeFileItem(RecipeType type) : this()
        {
            ProcessType = type;
        }

        #endregion

        #region Properties

        public RecipeType ProcessType { get; set; }

        public ObservableCollection<FileNode> FileListByProcessType
        {
            get => _fileListByProcessType;
            set
            {
                _fileListByProcessType = value;
                InvokePropertyChanged(nameof(FileListByProcessType));
            }
        }

        #endregion

        #region Methods

        /// <summary>
        /// 根据指定的工艺文件类型获取工艺文件前缀。
        /// </summary>
        /// <param name="fileTypes"></param>
        /// <returns></returns>
        public static string GetProcessFilesPrefix(string fileTypes)
        {
            if (string.IsNullOrEmpty(fileTypes))
                return string.Empty;

            switch (fileTypes.ToLower())
            {
                case "process":
                    return GetProcessFilesPrefix(RecipeType.Process);
                case "routine":
                    return GetProcessFilesPrefix(RecipeType.Routine);
                case "clean":
                    return GetProcessFilesPrefix(RecipeType.Clean);
                default:
                    return string.Empty;
            }
        }


        /// <summary>
        /// 根据指定的工艺文件类型获取工艺文件前缀。
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static string GetProcessFilesPrefix(RecipeType type)
        {
            switch (type)
            {
                case RecipeType.Process:
                    return "Sic\\Process";

                case RecipeType.Routine:
                    return "Sic\\Routine";

                case RecipeType.Clean:
                    return "Sic\\Clean";

                default:
                    return string.Empty;
            }
        }

        #endregion
    }
}
