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('PortalOwner'), name: 'Portal Owner', createdAt, updatedAt },

      {
        id: getId('OperationsManager'),
        name: 'Operations Manager',
        createdAt,
        updatedAt,
      },

      {
        id: getId('SalesRepresentative'),
        name: 'Sales Representative',
        createdAt,
        updatedAt,
      },

      {
        id: getId('CustomerBuyerAdmin'),
        name: 'Customer Buyer Admin',
        createdAt,
        updatedAt,
      },

      {
        id: getId('CustomerBuyer'),
        name: 'Customer Buyer',
        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',
      'accounts',
      'locations',
      'contacts',
      'product_categories',
      'products',
      'inventory_items',
      'price_lists',
      'price_list_items',
      'account_price_lists',
      'carts',
      'cart_items',
      'orders',
      'order_items',
      'shipments',
      'quotes',
      'quote_items',
      'sample_requests',
      'saved_lists',
      'saved_list_items',
      ,
    ];
    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(`READ_BUYER_PORTAL`),
        createdAt,
        updatedAt,
        name: `READ_BUYER_PORTAL`,
      },
    ]);
    await queryInterface.bulkInsert('permissions', [
      {
        id: getId(`READ_BUYER_TEAM_QUEUE`),
        createdAt,
        updatedAt,
        name: `READ_BUYER_TEAM_QUEUE`,
      },
    ]);
    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('PortalOwner'),
        permissionId: getId('CREATE_USERS'),
      },

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

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

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

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

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

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

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_ACCOUNTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_ACCOUNTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_ACCOUNTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_ACCOUNTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_ACCOUNTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_ACCOUNTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('DELETE_ACCOUNTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_ACCOUNTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('UPDATE_ACCOUNTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_ACCOUNTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_ACCOUNTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_LOCATIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_LOCATIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_LOCATIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_LOCATIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_LOCATIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_LOCATIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('DELETE_LOCATIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_LOCATIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('UPDATE_LOCATIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_LOCATIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('UPDATE_LOCATIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_LOCATIONS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_CONTACTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_CONTACTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_CONTACTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_CONTACTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_CONTACTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_CONTACTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('DELETE_CONTACTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_CONTACTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('UPDATE_CONTACTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_CONTACTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('UPDATE_CONTACTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_CONTACTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_PRODUCT_CATEGORIES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_PRODUCT_CATEGORIES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_PRODUCT_CATEGORIES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_PRODUCT_CATEGORIES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_PRODUCT_CATEGORIES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_PRODUCT_CATEGORIES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_PRODUCT_CATEGORIES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_PRODUCT_CATEGORIES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_PRODUCT_CATEGORIES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_PRODUCTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_PRODUCTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_PRODUCTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_PRODUCTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_PRODUCTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_PRODUCTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_PRODUCTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_PRODUCTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_PRODUCTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_INVENTORY_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_INVENTORY_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_INVENTORY_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_INVENTORY_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_INVENTORY_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_INVENTORY_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_INVENTORY_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_INVENTORY_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_INVENTORY_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_PRICE_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_PRICE_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_PRICE_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_PRICE_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_PRICE_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_PRICE_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_PRICE_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_PRICE_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_PRICE_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_ACCOUNT_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_ACCOUNT_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_ACCOUNT_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_ACCOUNT_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_ACCOUNT_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_ACCOUNT_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_ACCOUNT_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('UPDATE_ACCOUNT_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_ACCOUNT_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_ACCOUNT_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_CARTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_CARTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_CARTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_CARTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_CARTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_CARTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('DELETE_CARTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_CARTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('CREATE_CARTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_CARTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('UPDATE_CARTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('CREATE_CARTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_CARTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('UPDATE_CARTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_CART_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_CART_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_CART_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_CART_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_CART_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_CART_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('DELETE_CART_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_CART_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('CREATE_CART_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_CART_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('UPDATE_CART_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('CREATE_CART_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_CART_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('UPDATE_CART_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_ORDERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_ORDERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_ORDERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_ORDERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_ORDERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_ORDERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('DELETE_ORDERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_ORDERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('UPDATE_ORDERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_ORDERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('UPDATE_ORDERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_ORDERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('UPDATE_ORDERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_ORDER_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_ORDER_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_ORDER_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_ORDER_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_ORDER_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_ORDER_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('DELETE_ORDER_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_ORDER_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('UPDATE_ORDER_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_ORDER_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_ORDER_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_SHIPMENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_SHIPMENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_SHIPMENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_SHIPMENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_SHIPMENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_SHIPMENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('DELETE_SHIPMENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_SHIPMENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_SHIPMENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_SHIPMENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_QUOTES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_QUOTES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_QUOTES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_QUOTES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_QUOTES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_QUOTES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('DELETE_QUOTES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('CREATE_QUOTES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_QUOTES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('UPDATE_QUOTES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('CREATE_QUOTES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_QUOTES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('CREATE_QUOTES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_QUOTES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_QUOTE_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_QUOTE_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_QUOTE_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_QUOTE_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_QUOTE_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_QUOTE_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('DELETE_QUOTE_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('CREATE_QUOTE_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_QUOTE_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('UPDATE_QUOTE_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('CREATE_QUOTE_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_QUOTE_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('CREATE_QUOTE_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_QUOTE_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_SAMPLE_REQUESTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_SAMPLE_REQUESTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_SAMPLE_REQUESTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_SAMPLE_REQUESTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_SAMPLE_REQUESTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_SAMPLE_REQUESTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('DELETE_SAMPLE_REQUESTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_SAMPLE_REQUESTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('UPDATE_SAMPLE_REQUESTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('CREATE_SAMPLE_REQUESTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_SAMPLE_REQUESTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('UPDATE_SAMPLE_REQUESTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('CREATE_SAMPLE_REQUESTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_SAMPLE_REQUESTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_SAVED_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_SAVED_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_SAVED_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_SAVED_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_SAVED_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_SAVED_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('DELETE_SAVED_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_SAVED_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('CREATE_SAVED_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_SAVED_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('UPDATE_SAVED_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('CREATE_SAVED_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_SAVED_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('UPDATE_SAVED_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('CREATE_SAVED_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('READ_SAVED_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('UPDATE_SAVED_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('PortalOwner'),
        permissionId: getId('DELETE_SAVED_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('READ_SAVED_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('UPDATE_SAVED_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('OperationsManager'),
        permissionId: getId('DELETE_SAVED_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('SalesRepresentative'),
        permissionId: getId('READ_SAVED_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('CREATE_SAVED_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_SAVED_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('UPDATE_SAVED_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('CREATE_SAVED_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_SAVED_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('UPDATE_SAVED_LIST_ITEMS'),
      },

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

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

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

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

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        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_ACCOUNTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_ACCOUNTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_ACCOUNTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_ACCOUNTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_LOCATIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_LOCATIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_LOCATIONS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_LOCATIONS'),
      },

      {
        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_PRODUCT_CATEGORIES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_PRODUCT_CATEGORIES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_PRODUCT_CATEGORIES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_PRODUCT_CATEGORIES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_PRODUCTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_PRODUCTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_PRODUCTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_PRODUCTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_INVENTORY_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_INVENTORY_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_INVENTORY_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_INVENTORY_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_PRICE_LISTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_PRICE_LISTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_PRICE_LISTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_PRICE_LIST_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_PRICE_LIST_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_PRICE_LIST_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_PRICE_LIST_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_ACCOUNT_PRICE_LISTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_ACCOUNT_PRICE_LISTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_ACCOUNT_PRICE_LISTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_ACCOUNT_PRICE_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_CARTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_CARTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_CARTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_CARTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_CART_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_CART_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_CART_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_CART_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_ORDERS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_ORDERS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_ORDERS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_ORDERS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_ORDER_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_ORDER_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_ORDER_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_ORDER_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_SHIPMENTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_SHIPMENTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_SHIPMENTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_SHIPMENTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_QUOTES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_QUOTES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_QUOTES'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_QUOTES'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_QUOTE_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_QUOTE_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_QUOTE_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_QUOTE_ITEMS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_SAMPLE_REQUESTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_SAMPLE_REQUESTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_SAMPLE_REQUESTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_SAMPLE_REQUESTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_SAVED_LISTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_SAVED_LISTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_SAVED_LISTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_SAVED_LISTS'),
      },

      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('CREATE_SAVED_LIST_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('READ_SAVED_LIST_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('UPDATE_SAVED_LIST_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('Administrator'),
        permissionId: getId('DELETE_SAVED_LIST_ITEMS'),
      },

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

    await queryInterface.sequelize.query(`
    DELETE FROM "rolesPermissionsPermissions"
    WHERE "roles_permissionsId" IN (
      '${getId('CustomerBuyerAdmin')}',
      '${getId('CustomerBuyer')}'
    );
  `);

    await queryInterface.bulkInsert('rolesPermissionsPermissions', [
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_BUYER_PORTAL'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('READ_BUYER_TEAM_QUEUE'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('CREATE_ORDERS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('CREATE_ORDER_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('CREATE_SAMPLE_REQUESTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('CREATE_SAVED_LISTS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyerAdmin'),
        permissionId: getId('CREATE_SAVED_LIST_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('READ_BUYER_PORTAL'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('CREATE_ORDERS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('CREATE_ORDER_ITEMS'),
      },
      {
        createdAt,
        updatedAt,
        roles_permissionsId: getId('CustomerBuyer'),
        permissionId: getId('CREATE_SAMPLE_REQUESTS'),
      },
    ]);

    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('PortalOwner')}' WHERE "email"='client@hello.com'`,
    );
    await queryInterface.sequelize.query(
      `UPDATE "users" SET "app_roleId"='${getId('OperationsManager')}' WHERE "email"='john@doe.com'`,
    );
  },
};
