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: 0x02000027 RID: 39
	public class Workflow
	{
		// Token: 0x0600011A RID: 282 RVA: 0x00007262 File Offset: 0x00005462
		public Workflow(RoadMap schema)
		{
			this.workflow = schema;
		}

		// Token: 0x17000065 RID: 101
		// (get) Token: 0x0600011B RID: 283 RVA: 0x00007273 File Offset: 0x00005473
		internal RoadMap Flow
		{
			get
			{
				return this.workflow;
			}
		}

		// Token: 0x17000066 RID: 102
		// (get) Token: 0x0600011C RID: 284 RVA: 0x0000727C File Offset: 0x0000547C
		internal Queues Queues
		{
			get
			{
				bool flag = this.queues == null;
				if (flag)
				{
					this.queues = new Queues();
				}
				return this.queues;
			}
		}

		// Token: 0x17000067 RID: 103
		// (get) Token: 0x0600011D RID: 285 RVA: 0x000072AC File Offset: 0x000054AC
		// (set) Token: 0x0600011E RID: 286 RVA: 0x000072DC File Offset: 0x000054DC
		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: 0x17000068 RID: 104
		// (get) Token: 0x0600011F RID: 287 RVA: 0x000072E8 File Offset: 0x000054E8
		// (set) Token: 0x06000120 RID: 288 RVA: 0x00007354 File Offset: 0x00005554
		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: 0x17000069 RID: 105
		// (get) Token: 0x06000121 RID: 289 RVA: 0x00007360 File Offset: 0x00005560
		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: 0x1700006A RID: 106
		// (get) Token: 0x06000122 RID: 290 RVA: 0x000073B4 File Offset: 0x000055B4
		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: 0x1700006B RID: 107
		// (get) Token: 0x06000123 RID: 291 RVA: 0x00007408 File Offset: 0x00005608
		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: 0x1700006C RID: 108
		// (get) Token: 0x06000124 RID: 292 RVA: 0x0000745C File Offset: 0x0000565C
		internal Queue Queue
		{
			get
			{
				bool flag = this.queue == null;
				if (flag)
				{
					this.queue = new Queue(this);
				}
				return this.queue;
			}
		}

		// Token: 0x0400006F RID: 111
		private RoadMap workflow;

		// Token: 0x04000070 RID: 112
		private List<Schematics> blueprints;

		// Token: 0x04000071 RID: 113
		private List<Folder> folders;

		// Token: 0x04000072 RID: 114
		private Queues queues;

		// Token: 0x04000073 RID: 115
		private List<Origin> inputConfigurations;

		// Token: 0x04000074 RID: 116
		private List<Origin> outputConfigurations;

		// Token: 0x04000075 RID: 117
		private List<Origin> syncConfigurations;

		// Token: 0x04000076 RID: 118
		private Queue queue;
	}
}
