
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("CentralOperationsLead"), name: "Central Operations Lead", createdAt, updatedAt },
        
          { id: getId("ClinicalDirector"), name: "Clinical Director", createdAt, updatedAt },
        
          { id: getId("CityDoctorLead"), name: "City Doctor Lead", createdAt, updatedAt },
        
          { id: getId("RuralHealthOfficer"), name: "Rural Health Officer", createdAt, updatedAt },
        
          { id: getId("PatientMember"), name: "Patient Member", 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","admins","city_doctors","rural_doctors","patients","medical_reports","medicines","inventory_updates","medicine_dispatches","dispatch_items","medical_camps","appointments","chat_threads","messages","notifications","trucks","truck_tracking_events","vaccination_reminders","medicine_reminders","ai_chat_sessions","ai_chat_messages","audit_logs",,
    ];
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("CentralOperationsLead"), permissionId: getId('CREATE_USERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_USERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_USERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_USERS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_USERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_USERS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_USERS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_USERS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('UPDATE_USERS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_ADMINS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_ADMINS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_ADMINS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_ADMINS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_ADMINS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_CITY_DOCTORS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_CITY_DOCTORS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_CITY_DOCTORS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_CITY_DOCTORS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_CITY_DOCTORS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_CITY_DOCTORS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('READ_CITY_DOCTORS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_CITY_DOCTORS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_CITY_DOCTORS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('UPDATE_CITY_DOCTORS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_RURAL_DOCTORS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_RURAL_DOCTORS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_RURAL_DOCTORS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_RURAL_DOCTORS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_RURAL_DOCTORS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_RURAL_DOCTORS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_RURAL_DOCTORS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('READ_RURAL_DOCTORS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_RURAL_DOCTORS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('UPDATE_RURAL_DOCTORS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_PATIENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_PATIENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_PATIENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_PATIENTS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_PATIENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_PATIENTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('READ_PATIENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_PATIENTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('CREATE_PATIENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('READ_PATIENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_PATIENTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('UPDATE_PATIENTS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_MEDICAL_REPORTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_MEDICAL_REPORTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_MEDICAL_REPORTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_MEDICAL_REPORTS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('CREATE_MEDICAL_REPORTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_MEDICAL_REPORTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_MEDICAL_REPORTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('DELETE_MEDICAL_REPORTS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('CREATE_MEDICAL_REPORTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('READ_MEDICAL_REPORTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_MEDICAL_REPORTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('CREATE_MEDICAL_REPORTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('READ_MEDICAL_REPORTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_MEDICAL_REPORTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('READ_MEDICAL_REPORTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('UPDATE_MEDICAL_REPORTS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_MEDICINES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_MEDICINES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_MEDICINES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_MEDICINES') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_MEDICINES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_MEDICINES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('READ_MEDICINES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_MEDICINES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('READ_MEDICINES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_MEDICINES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('READ_MEDICINES') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_INVENTORY_UPDATES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_INVENTORY_UPDATES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_INVENTORY_UPDATES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_INVENTORY_UPDATES') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_INVENTORY_UPDATES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_INVENTORY_UPDATES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('READ_INVENTORY_UPDATES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_INVENTORY_UPDATES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('CREATE_INVENTORY_UPDATES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('READ_INVENTORY_UPDATES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_INVENTORY_UPDATES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_MEDICINE_DISPATCHES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_MEDICINE_DISPATCHES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_MEDICINE_DISPATCHES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_MEDICINE_DISPATCHES') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_MEDICINE_DISPATCHES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_MEDICINE_DISPATCHES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('CREATE_MEDICINE_DISPATCHES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('READ_MEDICINE_DISPATCHES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_MEDICINE_DISPATCHES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('CREATE_MEDICINE_DISPATCHES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('READ_MEDICINE_DISPATCHES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_MEDICINE_DISPATCHES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('UPDATE_MEDICINE_DISPATCHES') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_DISPATCH_ITEMS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_DISPATCH_ITEMS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_DISPATCH_ITEMS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_DISPATCH_ITEMS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_DISPATCH_ITEMS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_DISPATCH_ITEMS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('CREATE_DISPATCH_ITEMS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('READ_DISPATCH_ITEMS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_DISPATCH_ITEMS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('CREATE_DISPATCH_ITEMS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('READ_DISPATCH_ITEMS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_DISPATCH_ITEMS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('UPDATE_DISPATCH_ITEMS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_MEDICAL_CAMPS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_MEDICAL_CAMPS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_MEDICAL_CAMPS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_MEDICAL_CAMPS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_MEDICAL_CAMPS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_MEDICAL_CAMPS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('READ_MEDICAL_CAMPS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_MEDICAL_CAMPS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('READ_MEDICAL_CAMPS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_MEDICAL_CAMPS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('READ_MEDICAL_CAMPS') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_APPOINTMENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_APPOINTMENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_APPOINTMENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_APPOINTMENTS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_APPOINTMENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_APPOINTMENTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('CREATE_APPOINTMENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('READ_APPOINTMENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_APPOINTMENTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('CREATE_APPOINTMENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('READ_APPOINTMENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_APPOINTMENTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('CREATE_APPOINTMENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('READ_APPOINTMENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('UPDATE_APPOINTMENTS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_CHAT_THREADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_CHAT_THREADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_CHAT_THREADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_CHAT_THREADS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('CREATE_CHAT_THREADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_CHAT_THREADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_CHAT_THREADS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('CREATE_CHAT_THREADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('READ_CHAT_THREADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_CHAT_THREADS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('CREATE_CHAT_THREADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('READ_CHAT_THREADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_CHAT_THREADS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('CREATE_CHAT_THREADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('READ_CHAT_THREADS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('UPDATE_CHAT_THREADS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_MESSAGES') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('CREATE_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_MESSAGES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('CREATE_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('READ_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_MESSAGES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('CREATE_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('READ_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_MESSAGES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('CREATE_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('READ_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('UPDATE_MESSAGES') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_NOTIFICATIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_NOTIFICATIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_NOTIFICATIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_NOTIFICATIONS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_NOTIFICATIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_NOTIFICATIONS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('READ_NOTIFICATIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_NOTIFICATIONS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('READ_NOTIFICATIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_NOTIFICATIONS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('READ_NOTIFICATIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('UPDATE_NOTIFICATIONS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_TRUCKS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_TRUCKS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_TRUCKS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_TRUCKS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_TRUCKS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_TRUCKS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('READ_TRUCKS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_TRUCKS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('READ_TRUCKS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_TRUCKS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('READ_TRUCKS') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_TRUCK_TRACKING_EVENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_TRUCK_TRACKING_EVENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_TRUCK_TRACKING_EVENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_TRUCK_TRACKING_EVENTS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_TRUCK_TRACKING_EVENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_TRUCK_TRACKING_EVENTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('READ_TRUCK_TRACKING_EVENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_TRUCK_TRACKING_EVENTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('READ_TRUCK_TRACKING_EVENTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_TRUCK_TRACKING_EVENTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('READ_TRUCK_TRACKING_EVENTS') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_VACCINATION_REMINDERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_VACCINATION_REMINDERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_VACCINATION_REMINDERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_VACCINATION_REMINDERS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_VACCINATION_REMINDERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_VACCINATION_REMINDERS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('READ_VACCINATION_REMINDERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_VACCINATION_REMINDERS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('CREATE_VACCINATION_REMINDERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('READ_VACCINATION_REMINDERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_VACCINATION_REMINDERS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('READ_VACCINATION_REMINDERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('UPDATE_VACCINATION_REMINDERS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_MEDICINE_REMINDERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_MEDICINE_REMINDERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_MEDICINE_REMINDERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_MEDICINE_REMINDERS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_MEDICINE_REMINDERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_MEDICINE_REMINDERS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('READ_MEDICINE_REMINDERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_MEDICINE_REMINDERS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('CREATE_MEDICINE_REMINDERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('READ_MEDICINE_REMINDERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_MEDICINE_REMINDERS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('READ_MEDICINE_REMINDERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('UPDATE_MEDICINE_REMINDERS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_AI_CHAT_SESSIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_AI_CHAT_SESSIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_AI_CHAT_SESSIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_AI_CHAT_SESSIONS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_AI_CHAT_SESSIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_AI_CHAT_SESSIONS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_AI_CHAT_SESSIONS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_AI_CHAT_SESSIONS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('CREATE_AI_CHAT_SESSIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('READ_AI_CHAT_SESSIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('UPDATE_AI_CHAT_SESSIONS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_AI_CHAT_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_AI_CHAT_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_AI_CHAT_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_AI_CHAT_MESSAGES') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_AI_CHAT_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('UPDATE_AI_CHAT_MESSAGES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('UPDATE_AI_CHAT_MESSAGES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('UPDATE_AI_CHAT_MESSAGES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('CREATE_AI_CHAT_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('READ_AI_CHAT_MESSAGES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), permissionId: getId('UPDATE_AI_CHAT_MESSAGES') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('READ_AUDIT_LOGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('UPDATE_AUDIT_LOGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('DELETE_AUDIT_LOGS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('READ_AUDIT_LOGS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
     
  
      
      
        
            { createdAt, updatedAt, roles_permissionsId: getId("CentralOperationsLead"), permissionId: getId('CREATE_SEARCH') },
        
            { createdAt, updatedAt, roles_permissionsId: getId("ClinicalDirector"), permissionId: getId('CREATE_SEARCH') },
        
            { createdAt, updatedAt, roles_permissionsId: getId("CityDoctorLead"), permissionId: getId('CREATE_SEARCH') },
        
            { createdAt, updatedAt, roles_permissionsId: getId("RuralHealthOfficer"), permissionId: getId('CREATE_SEARCH') },
        
            { createdAt, updatedAt, roles_permissionsId: getId("PatientMember"), 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_ADMINS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_ADMINS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_ADMINS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_ADMINS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_CITY_DOCTORS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_CITY_DOCTORS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_CITY_DOCTORS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_CITY_DOCTORS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_RURAL_DOCTORS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_RURAL_DOCTORS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_RURAL_DOCTORS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_RURAL_DOCTORS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_PATIENTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_PATIENTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_PATIENTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_PATIENTS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_MEDICAL_REPORTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_MEDICAL_REPORTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_MEDICAL_REPORTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_MEDICAL_REPORTS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_MEDICINES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_MEDICINES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_MEDICINES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_MEDICINES') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_INVENTORY_UPDATES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_INVENTORY_UPDATES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_INVENTORY_UPDATES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_INVENTORY_UPDATES') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_MEDICINE_DISPATCHES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_MEDICINE_DISPATCHES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_MEDICINE_DISPATCHES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_MEDICINE_DISPATCHES') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_DISPATCH_ITEMS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_DISPATCH_ITEMS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_DISPATCH_ITEMS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_DISPATCH_ITEMS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_MEDICAL_CAMPS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_MEDICAL_CAMPS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_MEDICAL_CAMPS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_MEDICAL_CAMPS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_APPOINTMENTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_APPOINTMENTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_APPOINTMENTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_APPOINTMENTS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_CHAT_THREADS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_CHAT_THREADS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_CHAT_THREADS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_CHAT_THREADS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_MESSAGES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_MESSAGES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_MESSAGES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_MESSAGES') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_NOTIFICATIONS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_NOTIFICATIONS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_NOTIFICATIONS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_NOTIFICATIONS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_TRUCKS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_TRUCKS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_TRUCKS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_TRUCKS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_TRUCK_TRACKING_EVENTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_TRUCK_TRACKING_EVENTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_TRUCK_TRACKING_EVENTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_TRUCK_TRACKING_EVENTS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_VACCINATION_REMINDERS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_VACCINATION_REMINDERS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_VACCINATION_REMINDERS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_VACCINATION_REMINDERS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_MEDICINE_REMINDERS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_MEDICINE_REMINDERS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_MEDICINE_REMINDERS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_MEDICINE_REMINDERS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_AI_CHAT_SESSIONS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_AI_CHAT_SESSIONS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_AI_CHAT_SESSIONS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_AI_CHAT_SESSIONS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_AI_CHAT_MESSAGES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_AI_CHAT_MESSAGES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_AI_CHAT_MESSAGES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_AI_CHAT_MESSAGES') },
    
    { 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('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("CentralOperationsLead")}' WHERE "email"='client@hello.com'`);
        await queryInterface.sequelize.query(`UPDATE "users" SET "app_roleId"='${getId("ClinicalDirector")}' WHERE "email"='john@doe.com'`);
       
      
      

}
};

