
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("Administrator"), name: "Administrator", createdAt, updatedAt },
      
      
        
          { id: getId("sales_ops_lead"), name: "sales_ops_lead", createdAt, updatedAt },
        
          { id: getId("revenue_manager"), name: "revenue_manager", createdAt, updatedAt },
        
          { id: getId("sales_team_lead"), name: "sales_team_lead", createdAt, updatedAt },
        
          { id: getId("account_executive"), name: "account_executive", createdAt, updatedAt },
        
          { id: getId("sales_development_rep"), name: "sales_development_rep", 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","roles","permissions","companies","contacts","pipelines","pipeline_stages","leads","deals","activities","activity_files","deal_products","tags","lead_tags","deal_tags",,
    ];
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.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("sales_ops_lead"), permissionId: getId('CREATE_USERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('READ_USERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('UPDATE_USERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('DELETE_USERS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('READ_USERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('UPDATE_USERS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('READ_USERS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('READ_USERS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('READ_USERS') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('CREATE_COMPANIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('READ_COMPANIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('UPDATE_COMPANIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('DELETE_COMPANIES') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('CREATE_COMPANIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('READ_COMPANIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('UPDATE_COMPANIES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('CREATE_COMPANIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('READ_COMPANIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('UPDATE_COMPANIES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('CREATE_COMPANIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('READ_COMPANIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('UPDATE_COMPANIES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('READ_COMPANIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('UPDATE_COMPANIES') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('CREATE_CONTACTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('READ_CONTACTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('UPDATE_CONTACTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('DELETE_CONTACTS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('CREATE_CONTACTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('READ_CONTACTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('UPDATE_CONTACTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('CREATE_CONTACTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('READ_CONTACTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('UPDATE_CONTACTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('CREATE_CONTACTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('READ_CONTACTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('UPDATE_CONTACTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('CREATE_CONTACTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('READ_CONTACTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('UPDATE_CONTACTS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('CREATE_PIPELINES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('READ_PIPELINES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('UPDATE_PIPELINES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('DELETE_PIPELINES') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('READ_PIPELINES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('UPDATE_PIPELINES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('READ_PIPELINES') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('READ_PIPELINES') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('READ_PIPELINES') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('CREATE_PIPELINE_STAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('READ_PIPELINE_STAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('UPDATE_PIPELINE_STAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('DELETE_PIPELINE_STAGES') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('READ_PIPELINE_STAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('UPDATE_PIPELINE_STAGES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('READ_PIPELINE_STAGES') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('READ_PIPELINE_STAGES') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('READ_PIPELINE_STAGES') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('CREATE_LEADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('READ_LEADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('UPDATE_LEADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('DELETE_LEADS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('CREATE_LEADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('READ_LEADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('UPDATE_LEADS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('CREATE_LEADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('READ_LEADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('UPDATE_LEADS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('CREATE_LEADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('READ_LEADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('UPDATE_LEADS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('CREATE_LEADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('READ_LEADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('UPDATE_LEADS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('CREATE_DEALS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('READ_DEALS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('UPDATE_DEALS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('DELETE_DEALS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('CREATE_DEALS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('READ_DEALS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('UPDATE_DEALS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('CREATE_DEALS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('READ_DEALS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('UPDATE_DEALS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('CREATE_DEALS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('READ_DEALS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('UPDATE_DEALS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('READ_DEALS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('UPDATE_DEALS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('CREATE_ACTIVITIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('READ_ACTIVITIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('UPDATE_ACTIVITIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('DELETE_ACTIVITIES') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('CREATE_ACTIVITIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('READ_ACTIVITIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('UPDATE_ACTIVITIES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('CREATE_ACTIVITIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('READ_ACTIVITIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('UPDATE_ACTIVITIES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('CREATE_ACTIVITIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('READ_ACTIVITIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('UPDATE_ACTIVITIES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('CREATE_ACTIVITIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('READ_ACTIVITIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('UPDATE_ACTIVITIES') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('CREATE_ACTIVITY_FILES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('READ_ACTIVITY_FILES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('UPDATE_ACTIVITY_FILES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('DELETE_ACTIVITY_FILES') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('CREATE_ACTIVITY_FILES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('READ_ACTIVITY_FILES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('UPDATE_ACTIVITY_FILES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('CREATE_ACTIVITY_FILES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('READ_ACTIVITY_FILES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('UPDATE_ACTIVITY_FILES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('CREATE_ACTIVITY_FILES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('READ_ACTIVITY_FILES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('UPDATE_ACTIVITY_FILES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('CREATE_ACTIVITY_FILES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('READ_ACTIVITY_FILES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('UPDATE_ACTIVITY_FILES') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('CREATE_DEAL_PRODUCTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('READ_DEAL_PRODUCTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('UPDATE_DEAL_PRODUCTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('DELETE_DEAL_PRODUCTS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('CREATE_DEAL_PRODUCTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('READ_DEAL_PRODUCTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('UPDATE_DEAL_PRODUCTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('CREATE_DEAL_PRODUCTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('READ_DEAL_PRODUCTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('UPDATE_DEAL_PRODUCTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('CREATE_DEAL_PRODUCTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('READ_DEAL_PRODUCTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('UPDATE_DEAL_PRODUCTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('READ_DEAL_PRODUCTS') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('CREATE_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('READ_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('UPDATE_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('DELETE_TAGS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('CREATE_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('READ_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('UPDATE_TAGS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('CREATE_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('READ_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('UPDATE_TAGS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('CREATE_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('READ_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('UPDATE_TAGS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('READ_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('UPDATE_TAGS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('CREATE_LEAD_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('READ_LEAD_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('UPDATE_LEAD_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('DELETE_LEAD_TAGS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('CREATE_LEAD_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('READ_LEAD_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('UPDATE_LEAD_TAGS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('CREATE_LEAD_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('READ_LEAD_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('UPDATE_LEAD_TAGS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('CREATE_LEAD_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('READ_LEAD_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('UPDATE_LEAD_TAGS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('CREATE_LEAD_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('READ_LEAD_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('UPDATE_LEAD_TAGS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('CREATE_DEAL_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('READ_DEAL_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('UPDATE_DEAL_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('DELETE_DEAL_TAGS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('CREATE_DEAL_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('READ_DEAL_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('UPDATE_DEAL_TAGS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('CREATE_DEAL_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('READ_DEAL_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('UPDATE_DEAL_TAGS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('CREATE_DEAL_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('READ_DEAL_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('UPDATE_DEAL_TAGS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('READ_DEAL_TAGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), permissionId: getId('UPDATE_DEAL_TAGS') },
                    
                  
                    
                  
                  
             
          
    
  
    
     
  
      
      
        
            { createdAt, updatedAt, roles_permissionsId: getId("sales_ops_lead"), permissionId: getId('CREATE_SEARCH') },
        
            { createdAt, updatedAt, roles_permissionsId: getId("revenue_manager"), permissionId: getId('CREATE_SEARCH') },
        
            { createdAt, updatedAt, roles_permissionsId: getId("sales_team_lead"), permissionId: getId('CREATE_SEARCH') },
        
            { createdAt, updatedAt, roles_permissionsId: getId("account_executive"), permissionId: getId('CREATE_SEARCH') },
        
            { createdAt, updatedAt, roles_permissionsId: getId("sales_development_rep"), 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_ROLES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_ROLES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_ROLES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_ROLES') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_PERMISSIONS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_PERMISSIONS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_PERMISSIONS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_PERMISSIONS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_COMPANIES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_COMPANIES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_COMPANIES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_COMPANIES') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_CONTACTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_CONTACTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_CONTACTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_CONTACTS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_PIPELINES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_PIPELINES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_PIPELINES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_PIPELINES') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_PIPELINE_STAGES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_PIPELINE_STAGES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_PIPELINE_STAGES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_PIPELINE_STAGES') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_LEADS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_LEADS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_LEADS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_LEADS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_DEALS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_DEALS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_DEALS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_DEALS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_ACTIVITIES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_ACTIVITIES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_ACTIVITIES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_ACTIVITIES') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_ACTIVITY_FILES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_ACTIVITY_FILES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_ACTIVITY_FILES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_ACTIVITY_FILES') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_DEAL_PRODUCTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_DEAL_PRODUCTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_DEAL_PRODUCTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_DEAL_PRODUCTS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_TAGS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_TAGS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_TAGS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_TAGS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_LEAD_TAGS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_LEAD_TAGS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_LEAD_TAGS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_LEAD_TAGS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_DEAL_TAGS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_DEAL_TAGS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_DEAL_TAGS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_DEAL_TAGS') },
    
    
    
    { 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("sales_ops_lead")}' WHERE "email"='client@hello.com'`);
        await queryInterface.sequelize.query(`UPDATE "users" SET "app_roleId"='${getId("revenue_manager")}' WHERE "email"='john@doe.com'`);
       
      
      

}
};

