const { v4: uuid } = require('uuid');

module.exports = {
  /**
   * @param{import("sequelize").QueryInterface} queryInterface
   * @return {Promise<void>}
   */
  async up(queryInterface) {
    const createdAt = new Date();
    const updatedAt = new Date();

    /** @type {Map<string, string>} */
    const idMap = new Map();

    /**
     * @param {string} key
     * @return {string}
     */
    function getId(key) {
      if (idMap.has(key)) {
        return idMap.get(key);
      }
      const id = uuid();
      idMap.set(key, id);
      return id;
    }

    await queryInterface.bulkInsert('roles', [
      {
        id: getId('SuperAdmin'),
        name: 'Super Administrator',
        createdAt,
        updatedAt,
      },

      {
        id: getId('Administrator'),
        name: 'Administrator',
        createdAt,
        updatedAt,
      },

      {
        id: getId('PlatformManager'),
        name: 'PlatformManager',
        createdAt,
        updatedAt,
      },

      {
        id: getId('ContentSupervisor'),
        name: 'ContentSupervisor',
        createdAt,
        updatedAt,
      },

      {
        id: getId('MarketingLead'),
        name: 'MarketingLead',
        createdAt,
        updatedAt,
      },

      { id: getId('TechSupport'), name: 'TechSupport', createdAt, updatedAt },

      { id: getId('BasicUser'), name: 'BasicUser', createdAt, updatedAt },

      { id: getId('Public'), name: 'Public', createdAt, updatedAt },
    ]);

    /**
     * @param {string} name
     */
    function createPermissions(name) {
      return [
        {
          id: getId(`CREATE_${name.toUpperCase()}`),
          createdAt,
          updatedAt,
          name: `CREATE_${name.toUpperCase()}`,
        },
        {
          id: getId(`READ_${name.toUpperCase()}`),
          createdAt,
          updatedAt,
          name: `READ_${name.toUpperCase()}`,
        },
        {
          id: getId(`UPDATE_${name.toUpperCase()}`),
          createdAt,
          updatedAt,
          name: `UPDATE_${name.toUpperCase()}`,
        },
        {
          id: getId(`DELETE_${name.toUpperCase()}`),
          createdAt,
          updatedAt,
          name: `DELETE_${name.toUpperCase()}`,
        },
      ];
    }

    const entities = [
      'users',
      'analytics_daily',
      'analytics_events',
      'audit_logs',
      'blocks',
      'button_links',
      'domain_mappings',
      'email_logs',
      'feature_flags',
      'flags',
      'media_assets',
      'payment_transactions',
      'plans',
      'profile_pages',
      'social_links',
      'subscriptions',
      'templates',
      'roles',
      'permissions',
      'organizations',
      ,
    ];
    await queryInterface.bulkInsert(
      'permissions',
      entities.flatMap(createPermissions),
    );
    await queryInterface.bulkInsert('permissions', [
      {
        id: getId(`READ_API_DOCS`),
        createdAt,
        updatedAt,
        name: `READ_API_DOCS`,
      },
    ]);
    await queryInterface.bulkInsert('permissions', [
      {
        id: getId(`CREATE_SEARCH`),
        createdAt,
        updatedAt,
        name: `CREATE_SEARCH`,
      },
    ]);

    await queryInterface.bulkUpdate(
      'roles',
      { globalAccess: true },
      { id: getId('SuperAdmin') },
    );

    await queryInterface.sequelize
      .query(`create table "rolesPermissionsPermissions"
(
"createdAt"           timestamp with time zone not null,
"updatedAt"           timestamp with time zone not null,
"roles_permissionsId" uuid                     not null,
"permissionId"        uuid                     not null,
primary key ("roles_permissionsId", "permissionId")
);`);

    await queryInterface.bulkInsert('rolesPermissionsPermissions', [
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_USERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_USERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_USERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_USERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_USERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_USERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_USERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_USERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_USERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_USERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_USERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_USERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_ANALYTICS_DAILY'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_ANALYTICS_DAILY'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_ANALYTICS_DAILY'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_ANALYTICS_DAILY'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_ANALYTICS_DAILY'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_ANALYTICS_DAILY'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_ANALYTICS_DAILY'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_ANALYTICS_DAILY'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_ANALYTICS_DAILY'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_ANALYTICS_DAILY'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_ANALYTICS_DAILY'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_ANALYTICS_DAILY'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_ANALYTICS_EVENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_ANALYTICS_EVENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_ANALYTICS_EVENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_ANALYTICS_EVENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_ANALYTICS_EVENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_ANALYTICS_EVENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_ANALYTICS_EVENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_ANALYTICS_EVENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_ANALYTICS_EVENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_ANALYTICS_EVENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_ANALYTICS_EVENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_ANALYTICS_EVENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_AUDIT_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_AUDIT_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_AUDIT_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_AUDIT_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_AUDIT_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_AUDIT_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_AUDIT_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_AUDIT_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_AUDIT_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_AUDIT_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_AUDIT_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_AUDIT_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_BLOCKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_BLOCKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_BLOCKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_BLOCKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('CREATE_BLOCKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_BLOCKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_BLOCKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('DELETE_BLOCKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_BLOCKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_BLOCKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_BLOCKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_BLOCKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_BLOCKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_BLOCKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('CREATE_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('DELETE_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('CREATE_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('DELETE_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_DOMAIN_MAPPINGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_DOMAIN_MAPPINGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_DOMAIN_MAPPINGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_DOMAIN_MAPPINGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('CREATE_DOMAIN_MAPPINGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_DOMAIN_MAPPINGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_DOMAIN_MAPPINGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('DELETE_DOMAIN_MAPPINGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_DOMAIN_MAPPINGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_DOMAIN_MAPPINGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_DOMAIN_MAPPINGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_DOMAIN_MAPPINGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_DOMAIN_MAPPINGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_DOMAIN_MAPPINGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_EMAIL_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_EMAIL_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_EMAIL_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_EMAIL_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_EMAIL_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_EMAIL_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_EMAIL_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_EMAIL_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_EMAIL_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_EMAIL_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_EMAIL_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_EMAIL_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_FEATURE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_FEATURE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_FEATURE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_FEATURE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_FEATURE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_FEATURE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_FEATURE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_FEATURE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_FEATURE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_FEATURE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_FEATURE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_FEATURE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('CREATE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('DELETE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('CREATE_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('DELETE_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('CREATE_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('DELETE_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_PAYMENT_TRANSACTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_PAYMENT_TRANSACTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_PAYMENT_TRANSACTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_PAYMENT_TRANSACTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_PAYMENT_TRANSACTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_PAYMENT_TRANSACTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_PAYMENT_TRANSACTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_PAYMENT_TRANSACTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_PAYMENT_TRANSACTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_PAYMENT_TRANSACTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_PAYMENT_TRANSACTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_PAYMENT_TRANSACTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_PLANS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_PLANS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_PLANS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_PLANS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_PLANS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_PLANS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_PLANS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_PLANS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_PLANS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_PLANS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_PLANS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_PLANS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_PROFILE_PAGES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_PROFILE_PAGES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_PROFILE_PAGES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_PROFILE_PAGES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('CREATE_PROFILE_PAGES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_PROFILE_PAGES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_PROFILE_PAGES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('DELETE_PROFILE_PAGES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_PROFILE_PAGES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_PROFILE_PAGES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_PROFILE_PAGES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_PROFILE_PAGES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_PROFILE_PAGES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_PROFILE_PAGES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('CREATE_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('DELETE_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('CREATE_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('DELETE_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_SUBSCRIPTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_SUBSCRIPTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_SUBSCRIPTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_SUBSCRIPTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_SUBSCRIPTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_SUBSCRIPTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_SUBSCRIPTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_SUBSCRIPTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_SUBSCRIPTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_SUBSCRIPTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_SUBSCRIPTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_SUBSCRIPTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_TEMPLATES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('READ_TEMPLATES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('UPDATE_TEMPLATES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('DELETE_TEMPLATES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('READ_TEMPLATES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('UPDATE_TEMPLATES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('READ_TEMPLATES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('UPDATE_TEMPLATES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('READ_TEMPLATES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('UPDATE_TEMPLATES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('READ_TEMPLATES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('UPDATE_TEMPLATES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PlatformManager'),
        permissionId: getId('CREATE_SEARCH'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('ContentSupervisor'),
        permissionId: getId('CREATE_SEARCH'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('MarketingLead'),
        permissionId: getId('CREATE_SEARCH'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('TechSupport'),
        permissionId: getId('CREATE_SEARCH'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('BasicUser'),
        permissionId: getId('CREATE_SEARCH'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_USERS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_USERS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_USERS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_USERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_ANALYTICS_DAILY'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_ANALYTICS_DAILY'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_ANALYTICS_DAILY'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_ANALYTICS_DAILY'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_ANALYTICS_EVENTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_ANALYTICS_EVENTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_ANALYTICS_EVENTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_ANALYTICS_EVENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_AUDIT_LOGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_AUDIT_LOGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_AUDIT_LOGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_AUDIT_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_BLOCKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_BLOCKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_BLOCKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_BLOCKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_BUTTON_LINKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_BUTTON_LINKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_BUTTON_LINKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_DOMAIN_MAPPINGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_DOMAIN_MAPPINGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_DOMAIN_MAPPINGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_DOMAIN_MAPPINGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_EMAIL_LOGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_EMAIL_LOGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_EMAIL_LOGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_EMAIL_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_FEATURE_FLAGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_FEATURE_FLAGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_FEATURE_FLAGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_FEATURE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_FLAGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_FLAGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_FLAGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_MEDIA_ASSETS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_MEDIA_ASSETS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_MEDIA_ASSETS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_PAYMENT_TRANSACTIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_PAYMENT_TRANSACTIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_PAYMENT_TRANSACTIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_PAYMENT_TRANSACTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_PLANS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_PLANS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_PLANS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_PLANS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_PROFILE_PAGES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_PROFILE_PAGES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_PROFILE_PAGES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_PROFILE_PAGES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_SOCIAL_LINKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_SOCIAL_LINKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_SOCIAL_LINKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_SUBSCRIPTIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_SUBSCRIPTIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_SUBSCRIPTIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_SUBSCRIPTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_TEMPLATES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_TEMPLATES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_TEMPLATES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_TEMPLATES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_USERS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_USERS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_USERS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_USERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_ANALYTICS_DAILY'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_ANALYTICS_DAILY'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_ANALYTICS_DAILY'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_ANALYTICS_DAILY'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_ANALYTICS_EVENTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_ANALYTICS_EVENTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_ANALYTICS_EVENTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_ANALYTICS_EVENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_AUDIT_LOGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_AUDIT_LOGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_AUDIT_LOGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_AUDIT_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_BLOCKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_BLOCKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_BLOCKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_BLOCKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_BUTTON_LINKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_BUTTON_LINKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_BUTTON_LINKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_BUTTON_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_DOMAIN_MAPPINGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_DOMAIN_MAPPINGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_DOMAIN_MAPPINGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_DOMAIN_MAPPINGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_EMAIL_LOGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_EMAIL_LOGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_EMAIL_LOGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_EMAIL_LOGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_FEATURE_FLAGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_FEATURE_FLAGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_FEATURE_FLAGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_FEATURE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_FLAGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_FLAGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_FLAGS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_FLAGS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_MEDIA_ASSETS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_MEDIA_ASSETS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_MEDIA_ASSETS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_MEDIA_ASSETS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_PAYMENT_TRANSACTIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_PAYMENT_TRANSACTIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_PAYMENT_TRANSACTIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_PAYMENT_TRANSACTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_PLANS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_PLANS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_PLANS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_PLANS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_PROFILE_PAGES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_PROFILE_PAGES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_PROFILE_PAGES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_PROFILE_PAGES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_SOCIAL_LINKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_SOCIAL_LINKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_SOCIAL_LINKS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_SOCIAL_LINKS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_SUBSCRIPTIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_SUBSCRIPTIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_SUBSCRIPTIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_SUBSCRIPTIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_TEMPLATES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_TEMPLATES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_TEMPLATES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_TEMPLATES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_ROLES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_ROLES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_ROLES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_ROLES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_PERMISSIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_PERMISSIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_PERMISSIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_PERMISSIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_ORGANIZATIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_ORGANIZATIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('UPDATE_ORGANIZATIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('DELETE_ORGANIZATIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('READ_API_DOCS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SuperAdmin'),
        permissionId: getId('CREATE_SEARCH'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_API_DOCS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_SEARCH'),
      },
    ]);

    await queryInterface.sequelize.query(
      `UPDATE "users" SET "app_roleId"='${getId(
        'SuperAdmin',
      )}' WHERE "email"='super_admin@flatlogic.com'`,
    );
    await queryInterface.sequelize.query(
      `UPDATE "users" SET "app_roleId"='${getId(
        'Administrator',
      )}' WHERE "email"='admin@flatlogic.com'`,
    );

    await queryInterface.sequelize.query(
      `UPDATE "users" SET "app_roleId"='${getId(
        'PlatformManager',
      )}' WHERE "email"='client@hello.com'`,
    );
    await queryInterface.sequelize.query(
      `UPDATE "users" SET "app_roleId"='${getId(
        'ContentSupervisor',
      )}' WHERE "email"='john@doe.com'`,
    );
  },
};
