using System;
using System.Collections.Generic;
using System.IO;
using ZionRobot.Models.Items;
using ZionRobot.Models.Source;
using ZionRobot.Models.Workflow;
using ZionRobot.Models.Workflow.Components;
using ZionRobot.Persistence;
using ZionRobot.Tasks;
using ZionSchematics;

namespace ZionRobot.Models.Process
{
	// Token: 0x0200002F RID: 47
	public class Workflow
	{
		// Token: 0x06000160 RID: 352 RVA: 0x000084D2 File Offset: 0x000066D2
		public Workflow(RoadMap schema)
		{
			this.workflow = schema;
		}

		// Token: 0x17000084 RID: 132
		// (get) Token: 0x06000161 RID: 353 RVA: 0x000084E3 File Offset: 0x000066E3
		internal RoadMap Flow
		{
			get
			{
				return this.workflow;
			}
		}

		// Token: 0x17000085 RID: 133
		// (get) Token: 0x06000162 RID: 354 RVA: 0x000084EC File Offset: 0x000066EC
		internal Queues Queues
		{
			get
			{
				bool flag = this.queues == null;
				if (flag)
				{
					this.queues = new Queues();
				}
				return this.queues;
			}
		}

		// Token: 0x17000086 RID: 134
		// (get) Token: 0x06000163 RID: 355 RVA: 0x0000851C File Offset: 0x0000671C
		// (set) Token: 0x06000164 RID: 356 RVA: 0x0000854C File Offset: 0x0000674C
		internal List<Folder> Folders
		{
			get
			{
				bool flag = this.folders == null;
				if (flag)
				{
					this.folders = new List<Folder>();
				}
				return this.folders;
			}
			set
			{
				this.folders = value;
			}
		}

		// Token: 0x17000087 RID: 135
		// (get) Token: 0x06000165 RID: 357 RVA: 0x00008558 File Offset: 0x00006758
		// (set) Token: 0x06000166 RID: 358 RVA: 0x000085C4 File Offset: 0x000067C4
		internal List<Schematics> Blueprints
		{
			get
			{
				bool flag = this.blueprints == null;
				if (flag)
				{
					this.blueprints = new List<Schematics>();
					string location = Basic.BlueprintsFolder;
					this.workflow.InputSettings.Configurations.ForEach(delegate(Configuration x)
					{
						bool flag2 = System.IO.File.Exists(string.Format("{0}.bprt", Path.Combine(location, x.Blueprint)));
						if (flag2)
						{
							this.blueprints.Add(new Schematics(string.Format("{0}.bprt", Path.Combine(location, x.Blueprint))));
						}
					});
				}
				return this.blueprints;
			}
			set
			{
				this.blueprints = value;
			}
		}

		// Token: 0x17000088 RID: 136
		// (get) Token: 0x06000167 RID: 359 RVA: 0x000085D0 File Offset: 0x000067D0
		internal List<Origin> InputConfigurations
		{
			get
			{
				bool flag = this.inputConfigurations == null;
				if (flag)
				{
					this.inputConfigurations = new List<Origin>();
					this.workflow.InputSettings.Configurations.ForEach(delegate(Configuration config)
					{
						this.inputConfigurations.Add(new Origin(Path.Combine(Basic.ConfigurationFolder, config.Source + ".xml")));
					});
				}
				return this.inputConfigurations;
			}
		}

		// Token: 0x17000089 RID: 137
		// (get) Token: 0x06000168 RID: 360 RVA: 0x00008624 File Offset: 0x00006824
		internal List<Origin> OutputConfigurations
		{
			get
			{
				bool flag = this.outputConfigurations == null;
				if (flag)
				{
					this.outputConfigurations = new List<Origin>();
					this.workflow.OutputSettings.Configurations.ForEach(delegate(Configuration config)
					{
						this.outputConfigurations.Add(new Origin(Path.Combine(Basic.ConfigurationFolder, config.Source + ".xml")));
					});
				}
				return this.outputConfigurations;
			}
		}

		// Token: 0x1700008A RID: 138
		// (get) Token: 0x06000169 RID: 361 RVA: 0x00008678 File Offset: 0x00006878
		internal List<Origin> SyncConfigurations
		{
			get
			{
				bool flag = this.syncConfigurations == null;
				if (flag)
				{
					this.syncConfigurations = new List<Origin>();
					this.workflow.SyncSettings.Configurations.ForEach(delegate(Configuration config)
					{
						this.syncConfigurations.Add(new Origin(Path.Combine(Basic.ConfigurationFolder, config.Source + ".xml")));
					});
				}
				return this.syncConfigurations;
			}
		}

		// Token: 0x1700008B RID: 139
		// (get) Token: 0x0600016A RID: 362 RVA: 0x000086CC File Offset: 0x000068CC
		internal Queue Queue
		{
			get
			{
				bool flag = this.queue == null;
				if (flag)
				{
					this.queue = new Queue(this);
				}
				return this.queue;
			}
		}

		// Token: 0x04000083 RID: 131
		private RoadMap workflow;

		// Token: 0x04000084 RID: 132
		private List<Schematics> blueprints;

		// Token: 0x04000085 RID: 133
		private List<Folder> folders;

		// Token: 0x04000086 RID: 134
		private Queues queues;

		// Token: 0x04000087 RID: 135
		private List<Origin> inputConfigurations;

		// Token: 0x04000088 RID: 136
		private List<Origin> outputConfigurations;

		// Token: 0x04000089 RID: 137
		private List<Origin> syncConfigurations;

		// Token: 0x0400008A RID: 138
		private Queue queue;
	}
}
