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: 0x02000031 RID: 49
	public class Workflow
	{
		// Token: 0x0600016B RID: 363 RVA: 0x000087F6 File Offset: 0x000069F6
		public Workflow(RoadMap schema)
		{
			this.workflow = schema;
		}

		// Token: 0x17000089 RID: 137
		// (get) Token: 0x0600016C RID: 364 RVA: 0x00008807 File Offset: 0x00006A07
		internal RoadMap Flow
		{
			get
			{
				return this.workflow;
			}
		}

		// Token: 0x1700008A RID: 138
		// (get) Token: 0x0600016D RID: 365 RVA: 0x00008810 File Offset: 0x00006A10
		internal Queues Queues
		{
			get
			{
				bool flag = this.queues == null;
				if (flag)
				{
					this.queues = new Queues();
				}
				return this.queues;
			}
		}

		// Token: 0x1700008B RID: 139
		// (get) Token: 0x0600016E RID: 366 RVA: 0x00008840 File Offset: 0x00006A40
		// (set) Token: 0x0600016F RID: 367 RVA: 0x00008870 File Offset: 0x00006A70
		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: 0x1700008C RID: 140
		// (get) Token: 0x06000170 RID: 368 RVA: 0x0000887C File Offset: 0x00006A7C
		// (set) Token: 0x06000171 RID: 369 RVA: 0x000088E8 File Offset: 0x00006AE8
		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: 0x1700008D RID: 141
		// (get) Token: 0x06000172 RID: 370 RVA: 0x000088F4 File Offset: 0x00006AF4
		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: 0x1700008E RID: 142
		// (get) Token: 0x06000173 RID: 371 RVA: 0x00008948 File Offset: 0x00006B48
		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: 0x1700008F RID: 143
		// (get) Token: 0x06000174 RID: 372 RVA: 0x0000899C File Offset: 0x00006B9C
		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: 0x17000090 RID: 144
		// (get) Token: 0x06000175 RID: 373 RVA: 0x000089F0 File Offset: 0x00006BF0
		internal Queue Queue
		{
			get
			{
				bool flag = this.queue == null;
				if (flag)
				{
					this.queue = new Queue(this);
				}
				return this.queue;
			}
		}

		// Token: 0x04000089 RID: 137
		private RoadMap workflow;

		// Token: 0x0400008A RID: 138
		private List<Schematics> blueprints;

		// Token: 0x0400008B RID: 139
		private List<Folder> folders;

		// Token: 0x0400008C RID: 140
		private Queues queues;

		// Token: 0x0400008D RID: 141
		private List<Origin> inputConfigurations;

		// Token: 0x0400008E RID: 142
		private List<Origin> outputConfigurations;

		// Token: 0x0400008F RID: 143
		private List<Origin> syncConfigurations;

		// Token: 0x04000090 RID: 144
		private Queue queue;
	}
}
