export type DominionText = string;

export type DominionColor = {
	value: string;
	priority: number; // highest priority is "primary", second highest is "secondary".
	overridesAction?: boolean;
	onConflictDescriptionOnly?: boolean;
};

export type DominionBasicCardType = {
	typeType: "basic";
	name:
		| "Action"
		| "Treasure"
		| "Victory"
		| "Curse"
		| "Reaction"
		| "Duration"
		| "Reserve"
		| "Night"
		| "Attack"
		| "Command";
	color: null | DominionColor;
};
export type DominionBasicLandscapeType = {
	typeType: "basic";
	name: "Event" | "Landmark" | "Project" | "Way" | "Trait";
	color: null | DominionColor;
};

export type DominionCardType = DominionBasicCardType | DominionCustomCardType;
export type DominionLandscapeType =
	| DominionBasicLandscapeType
	| DominionCustomLandscapeType;

export type DominionCard =
	| {
			orientation: "card";
			title: string;
			description: DominionText;
			types: Array<DominionCardType>;
			image: string;
			artist: string;
			author: string;
			version: string;
			cost: DominionText;
			expansionIcon: string;
			preview?: DominionText;
	  }
	| {
			orientation: "landscape";
			title: string;
			description: DominionText;
			types: Array<DominionLandscapeType>;
			image: string;
			artist: string;
			author: string;
			version: string;
			cost: DominionText;
	  };

export type DominionCustomSymbol = {
	image: string;
};

export type DominionCustomCardType = {
	typeType: "custom";
	name: string;
	color: DominionColor;
};
export type DominionCustomLandscapeType = {
	typeType: "custom";
	name: string;
	color: DominionColor;
};

export type DominionExpansion = {
	cards: Array<DominionCard>;
	icon: string;
	customSymbols: Array<DominionCustomSymbol>;
	customCardTypes: Array<DominionCustomCardType>;
	customLandscapeTypes: Array<DominionCustomLandscapeType>;
};

export const TYPE_ACTION: DominionBasicCardType = {
	typeType: "basic",
	name: "Action",
	color: {
		value: "white",
		priority: 6,
	},
};

export const TYPE_TREASURE: DominionBasicCardType = {
	typeType: "basic",
	name: "Treasure",
	color: {
		value: "#ffe076",
		priority: 5,
	},
};

export const TYPE_VICTORY: DominionBasicCardType = {
	typeType: "basic",
	name: "Victory",
	color: {
		value: "#b3e5ad",
		priority: 4,
	},
};

export const TYPE_CURSE: DominionBasicCardType = {
	typeType: "basic",
	name: "Curse",
	color: {
		value: "#d285ff",
		priority: 4,
	},
};

export const TYPE_REACTION: DominionBasicCardType = {
	typeType: "basic",
	name: "Reaction",
	color: {
		value: "#81adff",
		priority: 1,
		overridesAction: true,
	},
};

export const TYPE_DURATION: DominionBasicCardType = {
	typeType: "basic",
	name: "Duration",
	color: {
		value: "#ffbc55",
		priority: 3,
		overridesAction: true,
	},
};

export const TYPE_RESERVE: DominionBasicCardType = {
	typeType: "basic",
	name: "Reserve",
	color: {
		value: "#e5c28b",
		priority: 2, // unknown whether this should be above or below reaction/duration?
		overridesAction: true,
	},
};

export const TYPE_NIGHT: DominionBasicCardType = {
	typeType: "basic",
	name: "Night",
	color: {
		value: "#485058",
		priority: 6,
		onConflictDescriptionOnly: true,
	},
};

export const TYPE_ATTACK: DominionBasicCardType = {
	typeType: "basic",
	name: "Attack",
	color: null,
};

export const TYPE_COMMAND: DominionBasicCardType = {
	typeType: "basic",
	name: "Command",
	color: null,
};
