using Cryville.Common;
using Cryville.Common.Collections.Generic;
using Cryville.Common.Pdt;
using Cryville.Crtr.Extension;
using Newtonsoft.Json;
using System.IO;
using System.Text;

namespace Cryville.Crtr.Ruleset {
	public class VirtualPlayerStrategy : MetaInfo {
		[JsonRequired]
		public long format;

		[JsonRequired]
		public string ruleset;

		[JsonIgnore]
		public PdtVirtualPlayerStrategy Root { get; private set; }

		public void LoadPdt(DirectoryInfo dir) {
			using (StreamReader pdtreader = new StreamReader(dir.FullName + "/" + data + ".pdt", Encoding.UTF8)) {
				var src = pdtreader.ReadToEnd();
				Root = (PdtVirtualPlayerStrategy)new RulesetInterpreter(src, null).Interpret(typeof(PdtVirtualPlayerStrategy));
			}
		}
	}

	[Binder(typeof(PdtBinder))]
	public class PdtVirtualPlayerStrategy {
		public Identifier[] use;
		public StrategyAction strategy;

		public void Generate() {

		}
	}

	public class StrategyAction {
		[ElementList]
		public PairList<RulesetSelectors, StrategyAction> Elements = new PairList<RulesetSelectors, StrategyAction>();
		[PropertyList]
		public PairList<ConstraintKey, PdtExpression> Properties = new PairList<ConstraintKey, PdtExpression>();
	}
}
