INSERT INTO `{prefix}packages` (`name`, `version`, `created_at`, `updated_at`) VALUES
('shaun_user_subscription', '1.4.0', NOW(), NOW());

INSERT INTO `{prefix}model_maps` (`subject_type`, `model_class`) VALUES
('user_subscription_package', 'Packages\\ShaunSocial\\UserSubscription\\Models\\UserSubscriptionPackage'),
('user_subscriptions', 'Packages\\ShaunSocial\\UserSubscription\\Models\\UserSubscription'),
('user_subscription_plan', 'Packages\\ShaunSocial\\UserSubscription\\Models\\UserSubscriptionPlan');

INSERT INTO `{prefix}subscription_types` (`type`, `order`, `class`) VALUES
('user_subscription', 1, 'Packages\\ShaunSocial\\UserSubscription\\Subscription\\SubscriptionTypeUserSubscription');

INSERT INTO `{prefix}mail_templates` (`type`, `subject`, `content`, `vars`, `created_at`, `updated_at`, `name`, `package`) VALUES
('user_subscription_active', '', '', '[link]', NOW(), NOW(), 'When a user buys subscription successfully', 'shaun_user_subscription'),
('user_subscription_remind', '', '', '[link],[date]', NOW(), NOW(), 'When reminder subscription', 'shaun_user_subscription'),
('user_subscription_stop', '', '', '[link]', NOW(), NOW(), 'When stop subscription', 'shaun_user_subscription');

INSERT INTO `{prefix}translations` (`table_name`, `column_name`, `foreign_key`, `locale`, `value`) VALUES
('mail_templates', 'subject', (SELECT `id` FROM `{prefix}mail_templates` WHERE `type` = 'user_subscription_active'), 'en', 'Your subscription to [site_name] was successfully activated'),
('mail_templates', 'content', (SELECT `id` FROM `{prefix}mail_templates` WHERE `type` = 'user_subscription_active'), 'en', '<p>[header]</p><p>You’ve been subscribed. If you’d like to change your subscription, you can do by clicking  the link below.</p><p><a href="[link]">Manage my subscriptions</a></p><p>[footer]</p>'),
('mail_templates', 'subject', (SELECT `id` FROM `{prefix}mail_templates` WHERE `type` = 'user_subscription_remind'), 'en', 'Your upcoming subscription renewal on [site_name]'),
('mail_templates', 'content', (SELECT `id` FROM `{prefix}mail_templates` WHERE `type` = 'user_subscription_remind'), 'en', '<p>[header]</p><p>This is just a friendly reminder that your subscription on [site_name] will renew automatically on [date].</p><p>You can manage your subscriptions by clicking on the link below</p><p><a href="[link]">Manage my subscriptions</a></p><p>[footer]</p>'),
('mail_templates', 'subject', (SELECT `id` FROM `{prefix}mail_templates` WHERE `type` = 'user_subscription_stop'), 'en', 'Your subscription on [site_name] has been stopped'),
('mail_templates', 'content', (SELECT `id` FROM `{prefix}mail_templates` WHERE `type` = 'user_subscription_stop'), 'en', '<p>[header]</p><p>You’ve been unsubscribed. If you’d like to change your subscription, you can do by clicking  the link below</p><p><a href="[link]">Manage my subscriptions</a></p><p>[footer]</p>');

INSERT INTO `{prefix}wallet_transaction_sub_types` (`parent_type_id`, `type`, `class`) VALUES
(4, 'user_subscription_buy', 'Packages\\ShaunSocial\\UserSubscription\\Wallet\\Payment\\UserSubscriptionTransactionTypeBuy');

INSERT INTO `{prefix}wallet_transaction_sub_types` (`parent_type_id`, `type`, `class`) VALUES
((SELECT `id` FROM `{prefix}wallet_transaction_types` WHERE `type` = 'commission'), 'user_subscription_buy', 'Packages\\ShaunSocial\\UserSubscription\\Wallet\\Commission\\UserSubscriptionTransactionTypePlan');
