const axios = require('../../axios');

/**
 * @param {string} host
 * @param {string} productId
 * @param {string} subProductId
 * @param {Record<string, any>} data
 * @param {string} token
 * @returns {Promise<*>}
 */
function updateSubProduct(host, productId, subProductId, data, token) {
  return axios.patch(
    `https://api.${host}/v2/products/${productId}/subproducts/${subProductId}`,
    data,
    {
      headers: {
        Authorization: `Bearer ${token}`,
        'Content-Type': 'application/json',
      },
    },
  );
}

module.exports = updateSubProduct;
