// Copyright (C) 2013 João Pedro Correia - All Rights Reserved
// Code under the terms of the GPLv2 license
// URL: http://flowstudio.codeplex.com

namespace FlowStudio.ViewModel.Data
{
    using System.Activities;
    using System.Activities.Presentation.Model;
    using System.ServiceModel.Activities;

    public static class OutlineItemFactory
    {
        public static OutlineItem GetOutlineItem(ModelItem modelItem)
        {
            if (modelItem.ItemType.IsAssignableFrom(typeof (ActivityBuilder)))
            {
                return new OutlineActivityBuilderItem(modelItem);
            }

            if (modelItem.ItemType.IsSubclassOf(typeof (Activity)))
            {
                return new OutlineActivityRootItem(modelItem);
            }

            if (modelItem.ItemType.IsAssignableFrom(typeof (WorkflowService)))
            {
                return new OutlineWorkflowServiceItem(modelItem);
            }

            return null;
        }
    }
}
