/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Intopenai
 * @copyright  Copyright 2006-2025 Ahead WebSoft Technologies
 * @license    https://socialengine.com/eula
 * @version    $Id: my.sql 2025-04-14 00:00:00Z 
 * @author     SocialEngine
 */

INSERT IGNORE INTO `engine4_core_modules` (`name`, `title`, `description`, `version`, `enabled`, `type`) VALUES  ('intopenai', 'Generative AI Powered Plugin', 'Generative AI Powered Plugin', '7.0.2', 1, 'extra') ;

INSERT IGNORE INTO `engine4_core_menuitems` (`name`, `module`, `label`, `plugin`, `params`, `menu`, `submenu`, `order`) VALUES
('core_admin_main_plugins_intopenai', 'intopenai', 'Generative AI Powered Plugin', '', '{"route":"admin_default","module":"intopenai","controller":"settings"}', 'core_admin_main_plugins', '', 999),
('intopenai_admin_main_settings', 'intopenai', 'Global Settings', '', '{"route":"admin_default","module":"intopenai","controller":"settings"}', 'intopenai_admin_main', '', 1);


INSERT IGNORE INTO `engine4_authorization_permissions`
  SELECT
    level_id as `level_id`,
    'intopenai' as `type`,
    'image' as `name`,
    1 as `value`,
    NULL as `params`
  FROM `engine4_authorization_levels` WHERE `type` IN('moderator', 'admin');
  INSERT IGNORE INTO `engine4_authorization_permissions`
  SELECT
    level_id as `level_id`,
    'intopenai' as `type`,
    'image_price' as `name`,
    0 as `value`,
    NULL as `params`
  FROM `engine4_authorization_levels` WHERE `type` IN('moderator', 'admin');
  INSERT IGNORE INTO `engine4_authorization_permissions`
  SELECT
    level_id as `level_id`,
    'intopenai' as `type`,
    'content' as `name`,
    1 as `value`,
    NULL as `params`
  FROM `engine4_authorization_levels` WHERE `type` IN('moderator', 'admin');
  INSERT IGNORE INTO `engine4_authorization_permissions`
  SELECT
    level_id as `level_id`,
    'intopenai' as `type`,
    'content_price' as `name`,
    0 as `value`,
    NULL as `params`
  FROM `engine4_authorization_levels` WHERE `type` IN('moderator', 'admin');


  INSERT IGNORE INTO `engine4_authorization_permissions`
  SELECT
    level_id as `level_id`,
    'intopenai' as `type`,
    'image' as `name`,
    1 as `value`,
    NULL as `params`
  FROM `engine4_authorization_levels` WHERE `type` IN('user');
  INSERT IGNORE INTO `engine4_authorization_permissions`
  SELECT
    level_id as `level_id`,
    'intopenai' as `type`,
    'image_price' as `name`,
    0 as `value`,
    NULL as `params`
  FROM `engine4_authorization_levels` WHERE `type` IN('user');
  INSERT IGNORE INTO `engine4_authorization_permissions`
  SELECT
    level_id as `level_id`,
    'intopenai' as `type`,
    'content' as `name`,
    1 as `value`,
    NULL as `params`
  FROM `engine4_authorization_levels` WHERE `type` IN('user');
  INSERT IGNORE INTO `engine4_authorization_permissions`
  SELECT
    level_id as `level_id`,
    'intopenai' as `type`,
    'content_price' as `name`,
    0 as `value`,
    NULL as `params`
  FROM `engine4_authorization_levels` WHERE `type` IN('user');