CREATE TABLE IF NOT EXISTS `basic_effect` (
  `id` smallint(6) NOT NULL AUTO_INCREMENT,
  `effectName` tinytext DEFAULT NULL,
  `effectDescription` varchar(250) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `basic_effect` (`id`, `effectName`, `effectDescription`) VALUES
	(1, 'Equip', 'Add this cards attack, and effect(s) to another'),
	(2, 'Heal', 'Untap X shield(s)'),
	(3, 'Hurt', 'Deal X damage to target unit, this combat'),
	(4, 'Recruit', 'Play from Hand'),
	(5, 'Give Flight', 'Give a unit [Flight]');
	

DROP TABLE `card_effect`;
CREATE TABLE IF NOT EXISTS `card_effect` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cardId` int(11) DEFAULT NULL,
  `effectId` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `card_effect` (`id`, `cardId`, `effectId`) VALUES
	(1, 1, 1);


CREATE TABLE IF NOT EXISTS `card_passive` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cardId` int(11) DEFAULT NULL,
  `passiveId` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;


DROP TABLE `effect`;
CREATE TABLE IF NOT EXISTS `effect` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `description` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `effect` (`id`, `description`) VALUES
	(1, '(Tap and Pay 1 Red): [Recruit] a [Red][Orc] unit; Give it [Flight] this turn.');


CREATE TABLE IF NOT EXISTS `effect_step` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `effectId` int(11) DEFAULT NULL,
  `stepOrder` tinyint(4) DEFAULT NULL,
  `basicEffectId` tinyint(4) DEFAULT NULL,
  `amount` smallint(6) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `effect_step` (`id`, `effectId`, `stepOrder`, `basicEffectId`, `amount`) VALUES
	(1, 1, 1, 4, 1),
	(2, 1, 2, 5, 1);


CREATE TABLE IF NOT EXISTS `effect_step_target` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `effectStep` int(11) DEFAULT NULL,
  `colourId` tinyint(4) DEFAULT NULL,
  `typeId` tinyint(4) DEFAULT NULL,
  `classId` tinyint(4) DEFAULT NULL,
  `passiveId` tinyint(4) DEFAULT NULL,
  `itemFromStep` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `effect_step_target` (`id`, `effectStep`, `colourId`, `typeId`, `classId`, `passiveId`, `itemFromStep`) VALUES
	(1, 1, 3, 1, 5, NULL, NULL),
	(2, 2, NULL, NULL, NULL, NULL, 1);


CREATE TABLE IF NOT EXISTS `effect_trigger` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `triggerTypeId` int(11) DEFAULT NULL,
  `cardEffectId` int(11) DEFAULT NULL,
  `amount` smallint(6) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `effect_trigger` (`id`, `triggerTypeId`, `cardEffectId`, `amount`) VALUES
	(1, 1, 1, NULL),
	(2, 2, 1, 1);


CREATE TABLE IF NOT EXISTS `effect_trigger_target` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `effectTriggerId` int(11) DEFAULT NULL,
  `colourId` tinyint(4) DEFAULT NULL,
  `typeId` tinyint(4) DEFAULT NULL,
  `classId` tinyint(4) DEFAULT NULL,
  `passiveId` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `effect_trigger_target` (`id`, `effectTriggerId`, `colourId`, `typeId`, `classId`, `passiveId`) VALUES
	(1, 2, 3, NULL, NULL, NULL);


CREATE TABLE IF NOT EXISTS `passive` (
  `id` tinyint(4) NOT NULL AUTO_INCREMENT,
  `passiveName` varchar(50) DEFAULT NULL,
  `passiveDescription` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `passive` (`id`, `passiveName`, `passiveDescription`) VALUES
	(1, 'Flight', 'Ignore taunt, unattackable by non-[Flight] units'),
	(2, 'Reach', 'Can attack [Flight] units');
	
	
CREATE TABLE IF NOT EXISTS `trigger_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

INSERT INTO `trigger_type` (`id`, `name`) VALUES
	(1, 'Tap'),
	(2, 'Pay');
